Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am able to generate XML file paths and shortening the path to only file name in the listbox, but I am unable to generate the XML to the datagridview.

What I have tried:

C#
private void ReadDropperScheduleFiles()
        {
            string folderPath = Directory.GetCurrentDirectory() + @"\" + "Libraries";
            string subfolder1 = folderPath + @"\" + "Dropper Schedule";
            string subfolder2 = folderPath + @"\" + "Support Schedule";

            lbxDropperLibrary.Items.Clear();
            try
            {
                string[] folder1 = Directory.GetFiles(subfolder1);
                string[] folder2 = Directory.GetFiles(subfolder2);

                foreach (string file1 in folder1)
                {
                    lbxDropperLibrary.Items.Add(Path.GetFileName(file1));
                }
                foreach (string file2 in folder2)
                {
                    lbxSupportLibrary.Items.Add(Path.GetFileName(file2));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("error " + ex.Message);
            }
Posted
Updated 6-Oct-23 9:13am
v2
Comments
OriginalGriff 15-Jul-23 4:04am    
And?
What have you tried?
Where are you stuck?
What help do you need?

None of the code you show has anything to do with XML or DataGridViews, so we have no idea where you are stuck ...

Use the "Improve question" widget to edit your question and provide better information.
Dave Kreskowiak 15-Jul-23 10:47am    
OK, so where is the code that's loading the .XML files and binding the grid to that data?
Ali Al Omairi(Abu AlHassan) 16-Jul-23 4:09am    
Do you mean that when you select a file the content of the file should be populated to datagrid?
If so you can check this link (https://learn.microsoft.com/en-us/dotnet/standard/linq/linq-xml-overview)
Maciej Los 21-Jul-23 15:17pm    
Sample ML data would be helpfull.
BTW: I'd suggest to read this: A Complete Sample of Custom Class Collection Serialization and Deserialization[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900