I am working in C# windows application . Datagrid view when binded with LIst><string> showing numbers 14, or 9, 12 like that.
In my requirement, user will type a letter in textbox , basing on that i will search for files in a specific path starting with that letter and populate datagrid view with matched filenames . For that i am using List <string> which will store all the file names.
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo( mypath );
System.IO.FileInfo dirFiles = di.GetFiles(textBox1.Text.ToUpper() + "*.*"); // ex: a*.* all file names starting with a
List<string> list = new List<string>();
foreach (FileInfo fi in dirFiles)
dataGridView2.DataSource = list;
i can see that list is populated with rows. But binding has got problem. datagridview is showing single digit numbers 9 and sometimes showing 14 like that. Kindly help me at what point i am doing mistake.