HighTechTalks DotNet Forums  

DataGridView - commit a row that is not editted

Dotnet Framework (WinForms Controls) microsoft.public.dotnet.framework.windowsforms.controls


Discuss DataGridView - commit a row that is not editted in the Dotnet Framework (WinForms Controls) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Hemol
 
Posts: n/a

Default DataGridView - commit a row that is not editted - 11-04-2007 , 11:52 AM






I have a DataGridView which I'm using the DefaultValuesNeeded to populate
every column in a row.

I'm only able to get a new editable row created if I manually edit one of
the cells (as soon as I hit a key in a cell to change the value, a new row
appears which can be clicked on and the DefaultValuesNeeded event get fired
again to populate that row.

Since all the cells have default values, and the user might not want to edit
any of the cells (just accept the default), I want to commit (not sure if
that's the right term)the row as soon as the default values are specified.
But I can't figure out the right combo of event(s) / method(s) to call to get
the DataGridView to just accept the defaults as a fully entered row of data.

This is a data bound control to a DataTable in a DataSet.

Thanks for any help.

Reply With Quote
  #2  
Old   
Hemol
 
Posts: n/a

Default RE: DataGridView - commit a row that is not editted - 11-04-2007 , 01:04 PM






Ah, figured it out I think:

In the DefaultValueNeeded event, after setting the values, I'm doing this:

DataGridView dgv = sender as DataGridView;
dgv.BindingContext[dgv.DataSource, dgv.DataMember].EndCurrentEdit();



"Hemol" wrote:

Quote:
I have a DataGridView which I'm using the DefaultValuesNeeded to populate
every column in a row.

I'm only able to get a new editable row created if I manually edit one of
the cells (as soon as I hit a key in a cell to change the value, a new row
appears which can be clicked on and the DefaultValuesNeeded event get fired
again to populate that row.

Since all the cells have default values, and the user might not want to edit
any of the cells (just accept the default), I want to commit (not sure if
that's the right term)the row as soon as the default values are specified.
But I can't figure out the right combo of event(s) / method(s) to call to get
the DataGridView to just accept the defaults as a fully entered row of data.

This is a data bound control to a DataTable in a DataSet.

Thanks for any help.

Reply With Quote
  #3  
Old   
Shawn.KL.Tucker@gmail.com
 
Posts: n/a

Default Re: DataGridView - commit a row that is not editted - 12-19-2007 , 05:45 PM



On Nov 4, 11:04 am, Hemol <He... (AT) discussions (DOT) microsoft.com> wrote:
Quote:
Ah, figured it out I think:

In the DefaultValueNeeded event, after setting the values, I'm doing this:

DataGridView dgv = sender as DataGridView;
dgv.BindingContext[dgv.DataSource, dgv.DataMember].EndCurrentEdit();



"Hemol" wrote:
I have a DataGridView which I'm using the DefaultValuesNeeded to populate
every column in a row.

I'm only able to get a new editable row created if I manually edit one of
the cells (as soon as I hit a key in a cell to change the value, a new row
appears which can be clicked on and the DefaultValuesNeeded event get fired
again to populate that row.

Since all the cells have default values, and the user might not want to edit
any of the cells (just accept the default), I want to commit (not sure if
that's the right term)the row as soon as the default values are specified.
But I can't figure out the right combo of event(s) / method(s) to call to get
the DataGridView to just accept the defaults as a fully entered row of data.

This is a data bound control to a DataTable in a DataSet.

Thanks for any help.- Hide quoted text -

- Show quoted text -
This does the same thing as DataGridView.EndEdit();


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.