| | |
Deleting of the last row in DataGridView
Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Sep 2008
Posts: 24
Reputation:
Solved Threads: 0
I'm sorry for spamming, won't happen again. I'm very new person in this forum and programming forum in general...
Even though, I'm not sure, that rowindex-1 is the answer for my question because rowindex points on the the exact row of the table. The deletions of other rows are successful with no errors.
Even though, I'm not sure, that rowindex-1 is the answer for my question because rowindex points on the the exact row of the table. The deletions of other rows are successful with no errors.
•
•
Join Date: Sep 2008
Posts: 24
Reputation:
Solved Threads: 0
Yes, I know, that deleting row according to currentcellindex works, but what if your selection is on the very last row in case that your property that allows users to add rows is on? That means that there are as if two last rows, one of them is traditional with some data like name, surname, age,... etc. with index [10,10], but when I tried to display the index of the row that functions to add new row via messagebox, it showed me [10,10] again. How can I distinguish between them? That one of them is impossible to delete because it serves for another purpose than displaying data from datasource?
•
•
Join Date: Jul 2008
Posts: 65
Reputation:
Solved Threads: 6
•
•
•
•
Yes, I know, that deleting row according to currentcellindex works, but what if your selection is on the very last row in case that your property that allows users to add rows is on? That means that there are as if two last rows, one of them is traditional with some data like name, surname, age,... etc. with index [10,10], but when I tried to display the index of the row that functions to add new row via messagebox, it showed me [10,10] again. How can I distinguish between them? That one of them is impossible to delete because it serves for another purpose than displaying data from datasource?
•
•
Join Date: Sep 2008
Posts: 24
Reputation:
Solved Threads: 0
OK, let's close this discussion. Seems I'm confusing and complicating things alot. I used the usual way to delete: select row by clicking on row header and then hit delete.
Some things also were not working properly with my datasource and I had some raising exceptions but now it's fixed.
Let's say, that the answer is:
DataGridView.Rows.RemoveAt(DataGridView.CurrentCell.RowIndex);
It really works also when the property for adding rows is set on true as I now tried that. I don't know why it now works, but probably the problem was in my chaotic solutions for dataset as the datasource for datagridview.
I'm sorry.
Some things also were not working properly with my datasource and I had some raising exceptions but now it's fixed.
Let's say, that the answer is:
DataGridView.Rows.RemoveAt(DataGridView.CurrentCell.RowIndex);
It really works also when the property for adding rows is set on true as I now tried that. I don't know why it now works, but probably the problem was in my chaotic solutions for dataset as the datasource for datagridview.
I'm sorry.
![]() |
Other Threads in the C# Forum
- Previous Thread: Problem with row that adds new rows in DataGridView
- Next Thread: Graph in 2D
| Thread Tools | Search this Thread |
.net access algorithm array asp.net barchart bitmap box broadcast buttons c# check checkbox client combobox control conversion csharp custom database databaseconnection datagrid datagridview dataset datetime dbconnection degrees design development draganddrop drawing encryption enum event eventhandlers excel file firefox form format forms function gdi+ grantorrevokepermissionthroughc#.net httpwebrequest image index input install java label libraries list listbox loop mandelbrot math mouseclick movingimage mysql mysql.data.client operator path photoshop picturebox pixelinversion platform post programming radians regex remote remoting resourcefile richtextbox server sleep socket sql statistics stream string system.servicemodel table tcpclientchannel text textbox thread time timer update usercontrol validation visualstudio webbrowser windows winforms wpf wpfc# xml






