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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top