Datagridview cellvalidating not working

I'm thinking that rather than trying to do this via Current Cell, etc., we should try using the underlying datasource instead.I know how we can do this, however, I just need to know how you bind your datagrid... If you let me know, I'll write you a handler so that we can examine the value in your validating event, and if the date is not proper, we can examine the underlying datasource, and view the .Also, now I know that you've bound your grid to a datatable in your dataset, so with that in mind, here is some code for your validation. I was desparately trying to find a way programmatically to reset the cell to Null, and I couldn't figure out any way to key in a Null. So now I have changed my Sql query back to returning date values, and simply changed the warning message in the cellvalidating event to: Message Box. Helpful for debugging and validating your SSL configuration.' Get a reference to the underlying data manager, managing your bound table in your datagrid. Binding Context(Da1), Currency Manager) ' Retrieve a Dataview representing the data in your currencymanager. List, Data View) ' Retrieve the row that we are validting. Then, what hit me like a thunderbolt is that when I'm working in Sql Server Enterprise manager I key in ctrl 0 to set a cell value to Null. Show("Invalid Date format", "Invalid Date" & vb Cr Lf & vb Cr Lf & "Enter Ctrl 0 to clear the field") I would still like to know how to programmatically set the cell to Null, but I can live with this solution, I could not live with casting the date values to a string. One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.Thanks so very much for all your help, and for sticking with me on this. If I ever bump into Bill Gates at a cocktail party, I'm going to ask him what the hell he was thinking when he created the dgv :) :) :) :) No worries, As for what was he thinking... Sql Connection(Te Bound is absolutely the correct term. Then the user lands on the cell by mistake, types any character, realizes he is on the wrong cell and trys to move, now he's in big trouble. Item property is really only meant to access other rowstate values...

I have a Data Grid View with many records, and each record has several date fields. OK, I got it working, but I'm not pleased with my solution.Deleting everything in the cell still does not evaluate to a NULL Thanks Ah, you need the VALUE in the current cell... I guess the experts are laughing at me, but I'm not the least bit impressed with What you've done, is retrieved information from the database, and bound it to a dataset. From this point on the dgv requires a date, or a null. Anyways, glad you got it to work, although, try just using the columnname, rather than the datarow's . Anyways, glad you got it, and let me know if that does work... Jake Scans your site and returns information about your SSL implementation and certificate.Steve B2175, I'm sorry that you are having all this trouble.Incidently, thanks for the points, although I'd like to work with you a bit further on this...

Microsoft is conducting an online survey to understand your opinion of the Msdn Web site.

Please or register to post comments
If spammers comment on your content, only you can see and manage such comments Delete all

Datagridview cellvalidating not working introduction

Datagridview cellvalidating not working

Recent posts

22-Dec-2018 02:37