DataGrid and BeforeColUpdate problem

DataGrid and BeforeColUpdate problem

Post by Marc » Tue, 08 Dec 1998 04:00:00



In VB5 i read new value in event BeforeColUpdate (DBGrid) with the
following statement:

newvalue = m_grid.Columns(ColIndex)

In VB6 and ADO this statement return the old value in the
DataGrid (not in DBGrid)

Does someone understand where is the new value ??????

Thanks for any help

Marco

 
 
 

1. Datagrid problem with BeforeColUpdate (bug?)

Summary:  Does anyone know how I can validate the user entry in a bound
Datagrid?  Does anyone else do this?

I've just tried several other approaches/kludges to no avail.  This brings
me to the realization that I _cannot_ validate what the user enters.

The problem is that the underlying recordset column has a datatype of
adDBTimestamp.  If you try and put something not timestamp-ish in there the
datagrid will catch it and tell you (with a lovely "Errors occurred"
message).  I need to trap and validate the entry before it gets there.  I
can't.

This is the chain of events:

1. User attempts to edit (by pressing a key or whatnot)
2. _BeforeColEdit is called.
3. User edits and finishes (by hitting enter or whatnot)
4. _BeforeColUpdate is called.
5. _AfterColUpdate is called.
6. _AfterColEdit is called.

If I do nothing and a problem occurs then the Datagrid catches it between
step 4 and 5 and step 5 never happens (although step 6 does).

The only place I can validate and modify the value before the Datagrid acts
on it is in step 4.  But I can't because I can't determine how to get the
value that the user entered (which appears to me to be a bug).  See the
replied-to post below.

The only other option I have is to munge the recordset so that the column
has a different datatype (e.g. varchar).  I could then check things in step
5 or 6 using saved values from step 2 or 4.  Munging the recordset is not
really acceptable (albeit possible).

Does anyone know how I can validate the user entry in a bound Datagrid?
Does anyone else do this?

thanks,
walt

2. SQL 7.0 transaction log

3. Q: Looking for Windows Explorer-Like Control

4. BeforeColUpdate Event in a DataGrid

5. Using Set IDENTITY_INSERT in sproc

6. BeforeColUpdate event in TrueDBGrid6

7. Access Reports

8. datagrid problem or SQL problem?

9. Copy from Datagrid to datagrid

10. Updating datagrid with requery, datagrid goes to top

11. Vb5 and Access 95 Datagrid problem

12. Datagrid problem - can't update