Results 1 to 2 of 2

Thread: gridview clears record?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    gridview clears record?

    Just been chucked into the deep end of a project and having a hard time remembering or understanding why its doing this. Basically there are some validation rules when entering data into a DataGridView.

    Now, if it fails, an error message is given - great (in the DataError event) and then the entire row of data is cleared out - but we dont want this.

    The e.Cancel = false is set but still for some reason, the entire row of data is being cleared.

    So, we enter some data into a new record in the DGV.
    One cell has a validation rule, if it fails, the dataError in the DGV is raised....
    error is shown
    the entire data is cleared from that row

    What can I check to prevent it from happening at all?



    looking further, there is an AddingNew event created for the DGV bindingsource which creates a new entry for that row, and shows its wiping out the data of course. how can we prevent that from happening when the validation fails/DataError event has been raised? Obviously want to do it the proper way, rather than say having a boolean value to look at globally to indicate if it should enter a new row or not
    Last edited by Techno; May 3rd, 2007 at 08:27 AM.

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: gridview clears record?

    figured it out thankfully....EndEdit() on the databindingsource object!

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width