Datagrid question (newbie)

  • Thread starter Thread starter Adriano
  • Start date Start date
A

Adriano

hello,

what's the way to hide the last row of DataGrid (the one for inserting new
data),
so my users can't insert newdata but only update and delete?

thanks in advance,
Adriano
 
The DataView associated with the DataGrid's datasource has a AllowNew
property that you can set. If the grid's datasource is a dataview, you can
set it directly on your dataview. But if you datasource is a
dataset/datatable, you need to do a little more work to get at the DataView
being used through the CurrencyManger object.

Dim cm as CurrencyManager =
CType(Me.DataGrid1.BindingContext(Me.DataGrid1.DataSource,Me.DataGrid1.DataM
ember), CurrencyManager)
Dim dv as DataView = CType(cm.List, DataView)
dv.AllowNew = False

If you are using hierarchical data, see
http://www.syncfusion.com/faq/winforms/search/653.asp for a sample event
handler when you can set this property for the child grids.

==========================
Clay Burch, .NET MVP

Visit www.syncfusion.com for the coolest tools
 

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