Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All
I am working on C# windows application VS2005 where I selected text file and enter the file in string array now I have to enter row by row of the array in a data grid view but I am not able to do the same
In the array I have number of rows with number of columns now I want to put all the rows with the columns in the data grid view
Can any one help me please
Posted
Updated 8-Mar-12 19:35pm
v2

1 solution

As explained here

http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.datasource.aspx[^]


The DataGridView class supports the standard Windows Forms data-binding model. This means the data source can be of any type that implements one of the following interfaces:

The IList interface, including one-dimensional arrays.
The IListSource interface, such as the DataTable and DataSet classes.
The IBindingList interface, such as the BindingList<t> class.
The IBindingListView interface, such as the BindingSource class.


The Array class implements IList interface. Hence, you can set DataGridView.DataSource to your array.
 
Share this answer
 
v3

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