Click here to Skip to main content
14,493,689 members
Rate this:
Please Sign up or sign in to vote.
See more:
my question is how to add no of rows to datagridview?

i have a datagridview which has 3 rows and i have button called create parts.when i clicked the button a dialog box will be displayed in that dialog box i have to select how many rows i need after selecting i will click add button in dialog box when i click the add button the no of rows has to be added to datagridview . pls any help thanks in advance.

What I have tried:

i tried only normal addition of rows in datagridview its not working i mean its working adding only one row i want specific no of rows which i was selecting in dialog box plz plz help me.
Posted
Updated 10-Sep-17 5:18am

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Try:
for (int i = 0; i < numberOfRows; i++)
   {
   DataGridViewRow row = new DataGridViewRow();
   ...
   myDataGridView.Rows.Add(row);
   }
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100