Disable Adding New Records in a DataGrid Control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Using VB.NET: I am populating a DataTable from a SQL Server table, then
associating that DataTable to a DataGrid control. I want to disallow the
user from inserting new records on that DataGrid, but I cannot find a way to
do this. Is there a way to prevent a user from inserting a new row through
the DataGrid - either
in the DataGrid itself, or in the original DataTable I am creating?

- Thanks,

JRD
 
John,

Your only possibility in that is
dataview(defaultview).allownew = false

(When you than want to add a row in code using the dataview you have to set
it temporaly to true)

Although the code in C# is exactly the same. Did you know that there is a
newsgroup
microsoft.public.dotnet.languages.vb
and as well
microsoft.public.framework.adonet

However I hope that the answer on your qeustion helps?

Cor


"John R. Dougherty"
 
What about if you wanted to have the new rows show up on the top of the
datagrid instead of the bottom?
 
Back
Top