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?
 

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