By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,000 Members | 1,265 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,000 IT Pros & Developers. It's quick & easy.

Please Help! - How can I tell if the blank DataGrid row is "editing"

P: n/a

I need to be able to tell if the blank row of a DataGrid has been edited or
not.

In a DataGrid, you may notice that if you click on the asterisk row, the
asterisk will change to a triangle, but no "new" blank asterisked row will be
added to the bottom *until* you type some data. How can I tell if you have
begun to type data into this row or not?

Here is the reason I need this. I need to call
CurrencyManager.EndCurrentEdit() on a row before I programmatically update/add
it to the datastore. This is so EndCurrentEdit() can auto-check for columns
that have their AllowDBNull set to false. The problem is that EndCurrentEdit()
checks for this condition and complains, regardless of whether somebody has
entered data into the blank row or not.

The Microsoft code does not do this. E.g. if you are on the "last" row of the
datagrid, but have not entered data, and you click somewhere else on the form,
no error message appears (but it will complain if you have entered data).

I stepped through the Microsoft assembly code to find out why this is, and
discovered (surprise surprise) that the Microsoft code has some private
esoteric function calls that somehow check the state of this row before
deciding to call EndCurrentEdit(). That is, if you are on the blank row, but
have not entered any data, the Microsoft code does NOT call EndCurrentEdit().
BUT, if you have entered some data in the blank row, the Microsoft code DOES
call EndCurrentEdit().

I want to check for this condition too, but I can't figure out how they are
doing it. Does anyone know what test I need to make, or if it is even possible?

Please, please someone let me know, this is driving me crazy!

--
Junkguy
Nov 15 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.