Datagrid cellvalidating event

The following Base Container Validate Editor Event Args properties provide information specific to this event. Editing Mode property, data in the Grid View can be edited in-place (directly within cells) or using an Edit Form (a form with standalone editors, which can be opened inline or as a separate modal window). Regardless of the data editing mode, you can handle the Validating Editor event to validate data within cells and within the Edit Form's standalone editors. The currently processed column is identified differently dependent on the data editing mode: Editor validation takes place when attempting to save the edit value of a cell or Edit Form's standalone editor. The editor determines whether it can accept the entered value.

While handling the Validating Editor event, you may need to identify the current row and column. After the automatic validation has been performed, the Validating Editor event is raised.

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...

I have a Data Grid View with many records, and each record has several date fields.

Jake Jake, I can't get this to work, and I'm very frustrated, so instead of venting my thought on ... Thanks, and maybe tomorrow I'll either "see the light" or have some intelligent questions.

Value (If it's not Value, it's something similar, not at my dev machine at the moment, so pardon me - can't test :) ).

It seems that once the user enters any character, I'm sunk. The bottom line is that it works, but it's pretty ugly.

Deleting everything in the cell still does not evaluate to a NULL Thanks ll. Value I put that in a button on the form, and entered some data, and then set the value. I guess the experts are laughing at me, but I'm not the least bit impressed with

If the entered value doesn't match your custom criteria, set the event's Valid parameter to false.' 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. Thanks so very much for all your help, and for sticking with me on this. Also, I would be grateful to know the correct way to describe exactly what I've done (i.e. ) 'String is created, now load the Data Grid View Dim Tedia Connection String As String = "Data Source='" & Server & "'; Initial Catalog=FSDBB1; Integrated Security=False; User ID=xxxxxx; Pwd=xxxxxx" Dim Tedia Connection As New Sql Client. The data in the Data View does not reflect that is in the current cell, and I can't find a way to set the value of the current cell to DBNull. In my example, if the dgv returned a null in a date cell it would appear as a blank (and properly so).

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...

My question is, if the date field was initially NULL how do I set it back to Null ?? Value (If it's not Value, it's something similar, not at my dev machine at the moment, so pardon me - can't test :) ). It seems that in the _Cell Validating event you must look at "e.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>