I have a ListBox & it has some files. I have 2 Panels in the same form & each Panel has many Labels which are corresponding tags of the loaded file in the ListBox.
Whenever the user selects each file then display the corresponding data of the selected file in the panel.
For an example this is one of the file content:
<connection>
<sourceId>sdfsdf</sourceId>
<description>test.sdfds.interact.loop.com</description>
<uri>https://test.sdf.interact.loop.com/WITSML/Store/Store.asmx</uri>
<username>sdfdsf</username>
<organizationFilter>*</organizationFilter>
<fieldFilter>*</fieldFilter>
</connection>
The listBox 1:
private void Form1_Load(object sender, EventArgs e)
{
PopulateListBox(listbox1, @"C:\TestLoadFiles", "*.rtld");
}
private void PopulateListBox(ListBox lsb, string Folder, string FileType)
{
DirectoryInfo dinfo = new DirectoryInfo(Folder);
FileInfo[] Files = dinfo.GetFiles(FileType);
foreach (FileInfo file in Files)
{
lsb.Items.Add(file.Name);
}
}
How can I read and display data? Some one please explain to me how can I read/parse xml files in a directory and display data????
This should get you started if I understand right.
EDIT:
Actually a switch might be better:
EDIT2:
So the listbox contains the file name.