Load a file - Leo-Corporation/LeoCorpLibrary GitHub Wiki
To use the following methods, you need to use the version 1.7 or higher of LeoCorpLibrary, and put this on top of your code file:
C#
using LeoCorpLibrary;
VB
Imports LeoCorpLibrary
To understand how the system works, read save system.
- The system is going to read the file
- The system is going to separate the elements
- The system is going to separate the columns
- From these informations, it will generate a
ListViewItem
. - Then it loads the
ListViewItem
inside the specified ListView.
This function is available in version 1.7 and higher.
Compatibility
Framework | LeoCorpLibrary | LeoCorpLibrary.Core |
---|---|---|
.NET 5 | ✔ | ❌ |
.NET Core 3.1 | ✔ | ❌ |
.NET Framework 4.7.2 | ✔ | ❌ |
.NET Framework 4.5 | ❌ | ❌ |
The ListViewContentCustom()
method enables you to load the content of a ListView from a file.
We recommand that you se these following parameters for your ListView:
-
Details
vue mode -
FullRowSelect
= true
There is two variations of the method:
Variation 1
LeoCorpLibrary.Load.ListViewContentCustom(ListView listView1, string filePath) {...}
Valeur | Paramètre | Description |
---|---|---|
ListView | listView | The ListView to load the content to |
string | filePath | The file location where the content is |
Variation 2
LeoCorpLibrary.Load.ListViewContentCustom(ListView listView1, string filePath, string itemSplit, string columnSplit) {...}
Valeur | Paramètre | Description |
---|---|---|
ListView | listView | ListView to load the content to |
string | filePath | The file location where the content is |
string | itemSplit | The element sparator |
string | columnSplit | The column separator |
Here's an example of usage:
C#
// Variation 1
LeoCorpLibrary.Load.ListViewContentCustom(listView1, @"C:\content.txt");
// Variation 2
LeoCorpLibrary.Load.ListViewContentCustom(listView1, @"C:\content.txt", "/*E*/", "/*C*/");
VB
' Variation 1
LeoCorpLibrary.Load.ListViewContentCustom(ListView1, "C:/content.txt")
' Variation 2
LeoCorpLibrary.Load.ListViewContentCustom(ListVew1, "C:/content.txt", "/*E*/", "/*C*/")
Note: in the examples, you might noticed that instead of simply writting
Load.ListViewContentCustom
, it is writtentLeoCorpLibrary.Load.ListViewContentCustom
. This because of a conflict withLoad
which is an event in Windows Forms.
This function is available in version 2.7 and higher.
Compatibility
Framework | LeoCorpLibrary | LeoCorpLibrary.Core |
---|---|---|
.NET 5 | ✔ | ❌ |
.NET Core 3.1 | ✔ | ❌ |
.NET Framework 4.7.2 | ✔ | ❌ |
.NET Framework 4.5 | ❌ | ❌ |
The ListViewContentXML()
method allows you to load a XML file that contains a listview's content.
We recommand that you use these following parameters for your ListView:
-
Details
vue mode -
FullRowSelect
= true
It has two arguments:
Value | Argument | Description |
---|---|---|
ListView | listView | ListView where it's content needs to be saved |
string | filePath | File location where to save the ListView's content |
Here's an example of usage:
C#
LeoCorpLibrary.Load.ListViewContentXML(listView1, "C:/test.xml");
VB
LeoCorpLibrary.Load.ListViewContentXML(listView1, "C:/test.xml")
Imput:
<?xml version="1.0" encoding="utf-8"?>
<ArrayOfArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ArrayOfString>
<string>Test1</string>
<string>Test2</string>
<string>Test3</string>
</ArrayOfString>
<ArrayOfString>
<string>Test4</string>
<string>Test5</string>
<string>Test6</string>
</ArrayOfString>
<ArrayOfString>
<string>Test7</string>
<string>Test7</string>
<string>Test8</string>
</ArrayOfString>
</ArrayOfArrayOfString>
Expected Output:
Column 1 | Column 2 | Column 3 |
---|---|---|
Test 1 | Test 2 | Test 3 |
Test 4 | Test 5 | Test 6 |
Test 8 | Test 8 | Test 9 |
This function is available in version 2.7 and higher.
Compatibility
Framework | LeoCorpLibrary | LeoCorpLibrary.Core |
---|---|---|
.NET 5 | ✔ | ❌ |
.NET Core 3.1 | ✔ | ❌ |
.NET Framework 4.7.2 | ❌ | ❌ |
.NET Framework 4.5 | ❌ | ❌ |
The ListViewContentJSON()
method allows you to load a listview's content from a JSON file.
We recommand that you use these following parameters for your ListView:
-
Details
vue mode -
FullRowSelect
= true
It has two arguments:
Value | Argument | Description |
---|---|---|
ListView | listView | ListView where it's content needs to be saved |
string | filePath | File location where to save the ListView's content |
Here's an example of usage:
C#
LeoCorpLibrary.Load.ListViewContentJSON(listView1, "C:/test.json");
VB
LeoCorpLibrary.Load.ListViewContentJSON(listView1, "C:/test.json")
Imput:
[
[
"Test1",
"Test2",
"Test3"
],
[
"Test4",
"Test5",
"Test6"
],
[
"Test7",
"Test7",
"Test8"
]
]
Expected Output:
Column 1 | Column 2 | Column 3 |
---|---|---|
Test 1 | Test 2 | Test 3 |
Test 4 | Test 5 | Test 6 |
Test 8 | Test 8 | Test 9 |