May be this question is not much important for you but I am facing problem in this. I have a DataGridView in which I add rows by.....
and the rows display like...
It's to add auto number into first. Datatable that is a datasource to the datagridview that has the serial number. Sql server 2005 to vb.net 2005 textbox.
Now I want to clear Row (Sl No. - 2)
but I want to maintain the serial numbers like below.
or I want to clear Row (Sl No. - 1)
and want to maintain the serial numbers like
It means I want to delete/clear a row from DataGridView
maintaining the serial numbers.
I tried like....
But failed to get the output.
How could I do this ?
Thanks in advance
RajRaj3 Answers
Data Grid View Vb Sample
I have found my answer. Sorry for the post.
While searching in DataGridView events, I found an event RowPrePaint
and just three lines of code of this event solved the problem.
Data Grid View
Thanks for viewing my post and also sorry for wasting your valuable time by missing the event
.
DataGridView.RowPrePaint
event will be raised every time when datagridview
must be repainting.
This will happened for example when you drag over datagridview
another form or MessageBox
or when you minimize/hide form
and reopen it again...
In your case you need update Serial No
only after count of the rows was changed.
Method Dgv_RowCountChanged
will be executed in the event handlers of RowsAdded
and RowsRemoved
Using Datagridview Vb
FabioFabioHere is how to create a Column index autogenerate serial number of each row:
Then on the codebehing:
Donald Duck