473,394 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

deleting last row in a DataGrid

Hello NG,
i have this problem: in my application, i have a master-
detail form displaying two DataGrids binded to DataViews.
While the bindings work fine when moving through the
grids' rows or making insertions, i keep encountering a
problem when trying to delete the last row in a grid
(problem occurs with both grids). Deleting any row other
than the last will complete successfully.
I have tried to handle all the underlying DataViews' and
DataTables' events, but i couldn't solve my problem.
Neither could i solve the problem by catching exceptions:
all the form routines include structured exception
handling, but the run-time error i get is about a null-
reference unhandled exception. Is it depending on the
DataGrid control trying to move to the next row (which of
course does not exist)?
I would appreciate any help, thank you in advance.
Best regards,

J.
Nov 20 '05 #1
1 1757
Just a thought . . .

Are you using context menus to call a delete function, if so, is this being
caught on MouseDown rather than mouse up ?, had something simelar before and
changed it to mouseUp which cured it.

If this is not the error, you can zip up the project if its not too big and
post it here otherwise, email it to me and I will try and help

--
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.
"J. A. Zanetti" <ja****@spammerssuck.org> wrote in message
news:11****************************@phx.gbl...
Hello NG,
i have this problem: in my application, i have a master-
detail form displaying two DataGrids binded to DataViews.
While the bindings work fine when moving through the
grids' rows or making insertions, i keep encountering a
problem when trying to delete the last row in a grid
(problem occurs with both grids). Deleting any row other
than the last will complete successfully.
I have tried to handle all the underlying DataViews' and
DataTables' events, but i couldn't solve my problem.
Neither could i solve the problem by catching exceptions:
all the form routines include structured exception
handling, but the run-time error i get is about a null-
reference unhandled exception. Is it depending on the
DataGrid control trying to move to the next row (which of
course does not exist)?
I would appreciate any help, thank you in advance.
Best regards,

J.

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Junkguy | last post by:
I'm having difficulty deleting rows from a datagrid. I want to put a "delete" button on a form and achieve the same functionality as hitting the "delete" key on the keyboard for the selected row of...
5
by: Mojtaba Faridzad | last post by:
Hi, with SetDataBinding( ) a DataGrid shows a DataView. user can select some rows in the grid by holding cotrol key. when user clicks on Delete button, I should delete all selected rows. I am...
2
by: Alex K. | last post by:
I am using datagrid bound to a datatable: DataTable dt = ...; MyGrid.DataSource = new DataView(dt); Now I am trying to intercept delete operation, when user highlights a row and presses...
0
by: Hrvoje Vrbanc | last post by:
Hello, this is a problem I came upon while building a site based on MCMS 2002 but it's not strictly MCMS-oriented: I have a page that displays a certain content in presentation mode but when an...
1
by: | last post by:
Hello, I have a datagrid bound to a datatable which has an Identity column. I load the table from data in a spreadsheet and manually assign seq. values to the identity column. Once that is...
2
by: rodchar | last post by:
hey all, i've got an asp.net page with a datagrid on it. when i delete all the rows in the datagrid it just shows the column headers. how are some ways i can clean that up? thanks, rodchar
10
by: Nick | last post by:
Hello, Please pardon my ignorance as I'm sure this is easy to do. I have a datagrid where I want to let the user delete columns. I added a context menu to the datagrid that has a delete option....
2
by: Ryan Liu | last post by:
private void dt_RowDeleted(object sender, DataRowChangeEventArgs e) { int id= (int)e.Row; if(id >5) { e.Row.RejectChanges(); MessageBox.Show(this, "Can not delete!" + id); }
9
by: Hamed | last post by:
Hello I have a DataGrid that a is bound to a DataTable. Some of the rows in the DataTable should not be deleted. How can I prohibit deleting of some identified rows? The problem could be...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.