Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all

I'm trying to create an Autocad plugin to preview thumbnails in datagridview

I have two listboxes I want to binding them together and show the .bmp in datagridview

1-listbox1 show Directory
2-listbox2 show subfolder from the selected folder (listbox1)
3-and then the .bmp files show in datagridview

I succeed to figure the first question

What I have tried:

C#
String[] dirs = System.IO.Directory.GetDirectories(@"D:\test\Blocks");
            int i;
            for (i = 0; i < dirs.Length; i++)
            {
                listBox1.Items.Add(Path.GetFileName(dirs[i]));
            }

            String[] files = System.IO.Directory.GetFiles(@"D:\test\Blocks");
            for (i = 0; i < files.Length; i++)
            {
                listBox1.Items.Add(Path.GetFileName(files[i]));
            }
Posted
Updated 30-Oct-17 4:34am
Comments
Richard MacCutchan 30-Oct-17 10:20am    
So what is the problem?
Mohamed Ahmed 30-Oct-17 10:29am    
I cannot bind listbox2?
I'm tried
if (listBox1.SelectedItem != null)
{
listBox2.Items.Add(listBox1.SelectedItem);
}
but not work
Richard MacCutchan 30-Oct-17 10:31am    
What does "not work" mean?
Mohamed Ahmed 30-Oct-17 10:33am    
listbox2 not showing the subfolder from selected listbox1

1 solution

Take a look at A Detailed Data Binding Tutorial[^], which has some clear expalnations and examples.
 
Share this answer
 
Comments
Mohamed Ahmed 30-Oct-17 10:49am    
I will try thank U

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