In DataGridView, how can i input data then add row
in order to add new row you have to define column in your grid then just add row like this
for example i have to textboxes txtName , txtFatherName and a grid with two columns , name and father name , a button , i want to add new row in my grid by clicking that button. use this code at the click event of the button
this will add row to your grid.
Use NewRow method of the datatable to get a blank datarow but with the schema as that of the datatable. You can populate this datarow and then add the row to the datatable using .Rows.Add(DataRow) OR .Rows.InsertAt(DataRow, Position).For more tips visit http://www.dapfor.com/en/net-suite/net-grid/features/performance
thanks a lot! Problem solved!
We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.