DataGridView Cell Previous Value

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roach

    #1

    DataGridView Cell Previous Value

    VB.NET 2005 2.0 Framework application is using a DataGridView for SQL
    data access and user data entry. As part of exception/error handling,
    the app wants to advise the user when he/she enters a value into a DGV
    field that is inappropriate; for example, an alpha character in a cell
    containing an integer value. When the user types in the alpha and
    hits enter, BeginEdit fires off, realizes the cell is dirty, and can
    see the previous/old cell .Value, but not the newly entered character/
    value. DataError then promptly frags the entry (interdicting
    CellValueChange d execution), but again can't say what value/
    character(s) the user entered that were inappropriate. Since the
    entered characters persist on the DGV (until .CancelEdit and .EndEdit
    are called), they must be somehow accessible; can anyone explain how
    to grab them?

    Thanks for your help!

  • Brendon Bezuidenhout

    #2
    Re: DataGridView Cell Previous Value

    Hey Roach,

    If you handle validation on a cellular level you can access the formatted
    value or cancel the validation and value being changed at all...

    look into the DataGridViewCel lValidatingEven tArgs and the CellValidating( )
    method of the DGV:
    http://msdn2.microsoft.com/en-us/lib...rs(VS.90).aspx

    HTH
    Brendon

    "Roach" <TLRoach@uss.co mwrote in message
    news:1193662431 .301639.109930@ v3g2000hsg.goog legroups.com...
    VB.NET 2005 2.0 Framework application is using a DataGridView for SQL
    data access and user data entry. As part of exception/error handling,
    the app wants to advise the user when he/she enters a value into a DGV
    field that is inappropriate; for example, an alpha character in a cell
    containing an integer value. When the user types in the alpha and
    hits enter, BeginEdit fires off, realizes the cell is dirty, and can
    see the previous/old cell .Value, but not the newly entered character/
    value. DataError then promptly frags the entry (interdicting
    CellValueChange d execution), but again can't say what value/
    character(s) the user entered that were inappropriate. Since the
    entered characters persist on the DGV (until .CancelEdit and .EndEdit
    are called), they must be somehow accessible; can anyone explain how
    to grab them?
    >
    Thanks for your help!
    >

    Comment

    Working...