Validating datagridview cell in vb net

It creates a new blank line and I still can't add anything.

But if I tab and select enter on one of the existing lines I do get the datagridview default error dialog with all the messy info you talked of.

I have a Data Grid View and I am Validating a column, in this case it's a zip Code column. Cell Leave Dim dgv Sender As Data Grid View = sender 'Msg Box(dgv Sender.

I have a procedure that verifies the zip Code and adds the 4 digit extension, the problem I am having is changing the value of the zip Code column while it's being validated, If I use: dgv.current Row. which event are you handling, so i can get what type of object e is?

However I would also like to erase the content of the cell currently in edit mode.I could easily do this using Cell Value Changed but I don't want the user to be able to leave the cell if the zip Code is not valid. Thanks Perrin you may have to reference it through the sender obj that is passed. this may be the datagrid itself or the datagridviewrow, you will have to msgbox a sender. Then you can code directly against the sender, and that should work. Here is my code: Private Sub Swipe Accumulative Hours Data Grid View_Cell Validating(By Val sender As Object, By Val e As System. Cell Validating If Swipe Accumulative Hours Data Grid View. So this has been an extremely intense learning curve because I've been a cobol/structured programming programmer. I only have 1 month left to show some results because they do not understand the learning curve for this (I mentioned an IT manager with no knowledge of this - who can't understand why this isn't as fast and easy as using excel)So I'm not sure getting the book to understand this will help me in my timeframe at the moment. I was hired by a company as and analyst programmer.

Leave a Reply