array[r,c] = (ran.Next(dim)); // fill it with random numbers.
}
}
// 2. Create ArrayDataView class in which
// constructor you pass the array
// and assign it to DataSource property of DataGrid.
dataGrid1.DataSource = new ArrayDataView(array);
When you change data in array and want to see update in DataGrid you need to call Reset method of ArrayDataView class. You can use all kind of base types like double, int32, string and so on.
But the expected result is not comming....Please solve the issue .....
+1
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Aug 14, 2020, 1:18 AM EDT
+1
Are you added required number of rows or grid is already bindind ?. Modified your code little bit check it. eloborate more what your going to do, what you have done so far.
datagridview1.Rows.Clear();
while(r
{
while(c
{
datagridview1.Rows.Add()
// value is already loaded in the arrray Fields......
Arijeet GhoshRank #7,940 · 231 reputationPosted Aug 14, 2020, 2:02 AM EDT
+1
There is a problem....you cannot add rows programmatically....
There are two files.....a) containing the data structure i.e. the column names and b) the data....
The datagridview is bound to the first file i.e. datastructure file and the second file is free...
I want to use this second filewith the datagridview as I have used first file. Both the files are to be attached to one datagridview....one for the structure and the second for the data...
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Aug 13, 2020, 7:00 PM EDT
Harsh ShahRank #1,322 · 1.3K reputationPosted Aug 13, 2020, 8:09 PM EDT
Arijeet GhoshRank #7,940 · 231 reputationPosted Aug 14, 2020, 12:52 AM EDT
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Aug 14, 2020, 1:18 AM EDT
Arijeet GhoshRank #7,940 · 231 reputationPosted Aug 14, 2020, 1:29 AM EDT
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Aug 14, 2020, 1:36 AM EDT
Arijeet GhoshRank #7,940 · 231 reputationPosted Aug 14, 2020, 2:02 AM EDT
Laxmidhar SahooRank #383 · 6.6K reputationPosted Aug 14, 2020, 2:36 AM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts