Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange DataGridView behavior

Status
Not open for further replies.

hymie42

Programmer
Mar 8, 2011
2
GB
I have a bunch of DGVs on a fairly complex form. All DGVs are generated at runtime and filled programatically, and all works OK except when the user enters new data in a new grid row and clicks on save.

The form then will not close until the user goes back to the row in question, changes the text and presses enter.

The whole issue seems to center around the enter key being pressed after the edit.

I have tried many flavours of endedit, sendkeys etc, but still stumped.

Any ideas more than welcomed.

Regards,

Hymie
 
Are you doing any validation that could result with a e.Cancel = True ? That would cause a halt event to force a "correction" in the cell before the grid "lets go" and allows other functions to execute.

--------------------------------------------------
“Crash programs fail because they are based on the theory that, with nine women pregnant, you can get a baby a month.” --Wernher von Braun
--------------------------------------------------
 
Hi ousoonerjoe,

Thanks for that. After days of looking for the issue I removed the "EndEdit" from the ValueChanged handler and hey presto it works!

Very odd - I would have thought that an "EndEdit" should be done before working with the DGV values.

So I think you were on the right lines there - if I had posted this last week your answer would have saved me some time.:)

We learn all the time!

Regards,

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top