question about datagrid(WinForm)

  • Thread starter Thread starter Fox
  • Start date Start date
F

Fox

How can I avoid datagrid to add a new record.
Only allow datagrid to edit old record.

Thank,
 
Hi,

After you've bound the grid to the data source, do the following:

CurrencyManager cm = this.BindingContext[theGrid.DataSource,
theGrid.DataMember].List as CurrencyManager;
DataView view = (DataView)cm.List;
view.AllowNew = false;
 
It's work, Thank you very much.
Dmitriy Lapshin said:
Hi,

After you've bound the grid to the data source, do the following:

CurrencyManager cm = this.BindingContext[theGrid.DataSource,
theGrid.DataMember].List as CurrencyManager;
DataView view = (DataView)cm.List;
view.AllowNew = false;

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx\

Fox said:
How can I avoid datagrid to add a new record.
Only allow datagrid to edit old record.

Thank,
 
Back
Top