Click here to Skip to main content
15,891,726 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

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

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