PC Review


Reply
Thread Tools Rate Thread

datagridview delete calls DefaultValuesNeeded

 
 
mrstrong
Guest
Posts: n/a
 
      13th Dec 2006
Gday,

I have a datagridview who's datasource is a view (from oracle) but it
has a couple of combo boxes in it that when changed updates the
underlying table that this view is based off.

Anyway, it seems to work fine, however when I delete a row, and there
is only one row it deletes fine however it calls the
"defaultvaluesneeded" method for the datagridview and creates new IDs
etc...

Then when I go to enter data in what appears to be the first row, it
does not create new ID's for this row which causes problems with
validation (cell validation method updates the underlying table) - and
I do not know what happens to the new row that was apparently created
when the "defaultvaluesneeded"
method was called after the delete...

Has anyone had this problem before or perhaps can show me the error of
my ways?

Thanks!

Peter

 
Reply With Quote
 
 
 
 
New Member
Join Date: Sep 2011
Posts: 1
 
      21st Sep 2011
Had the same problem for datagridviews, that are bounded to a BindingSource. Manifests after deleting the last row in the datagridview - if a row is added by typing in values, not all cells have default values set. Effect is not related to column order or visibility; in my case, one integer column value was set, but another was not. A string value was also set ok. Maybe the bug related to the datatype - works one time for each datatype?

The problem was solved as follows: to set initial cell values, instead DatagridView.DefaultValuesNeeded event use BindingSource.AddingNew event. At least, it worked for me.

If there is a similar event for DataTable, it might also work.
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataGridView Sort calls Form.Shown mahesh.nimbalkar@gmail.com Microsoft Dot NET Framework Forms 1 31st Jul 2007 01:15 PM
C# - 2.0 - Datagridview - DefaultValuesNeeded Arne Microsoft C# .NET 0 6th Jun 2006 09:17 PM
Refreshing datagridview contents after a failed delete in bound datagridview Bob Microsoft VB .NET 0 5th Jan 2006 06:34 PM
VS2005 - DefaultValuesNeeded - bug? Adding default values in DataGridView dbuchanan Microsoft Dot NET Framework Forms 6 8th Dec 2005 07:23 PM
VS2005 - DefaultValuesNeeded - bug? Adding default values in DataGridView dbuchanan Microsoft VB .NET 6 8th Dec 2005 07:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:46 AM.