FAQ: 5.5 How do I prevent the datagrid from displaying its append row

Can anybody translate the C# code to VB.NET in this article? I translated it as such: Dim cm As CurrencyManager = Me.BindingContext(Me.DataGrid1.DataSource, Me.DataGrid1.DataMember) Dim dv As DataView = cm.List dv.AllowNew = False but when I run the form, the Append row still appears. Please send your response via email to [email protected] as well.

7 Replies

II Iulian Ionescu January 5, 2003 09:02 PM UTC

I do it like this, where ME is the datagrid: Dim dv As DataView dv = CType(Me.DataSource, DataView) dv.AllowNew = False > Can anybody translate the C# code to VB.NET in this article? I translated it as such: > > Dim cm As CurrencyManager = Me.BindingContext(Me.DataGrid1.DataSource, Me.DataGrid1.DataMember) > > Dim dv As DataView = cm.List > > dv.AllowNew = False > > but when I run the form, the Append row still appears. > > Please send your response via email to [email protected] as well.


IS Isha March 12, 2003 03:27 AM UTC

U can use the following code i) If the datasource is a data table then, dgrd.DataSource.DefaultView.AllowNew = False (dgrd is the Datagrid) ii) If the datasource is a data set then, dgrd.DataMember.DefaultView.AllowNew = False (dgrd is the Datagrid) iii) or u can directly set it as follows objDataTable.DefaultView.AllowNew = False (objDataTable is the table being displayed on the grid) > Can anybody translate the C# code to VB.NET in this article? I translated it as such: > > Dim cm As CurrencyManager = Me.BindingContext(Me.DataGrid1.DataSource, Me.DataGrid1.DataMember) > > Dim dv As DataView = cm.List > > dv.AllowNew = False > > but when I run the form, the Append row still appears. > > Please send your response via email to [email protected] as well.


JA ja September 5, 2003 06:29 PM UTC

Ninguno funciona... :-(


JN Johnny Nguyen September 5, 2003 07:52 PM UTC

I have a master-details datagrid with relations. And I tried all the method below (in VB.NET) and it did NOT seem to work. Can someone show how to make it work with Master-detail grid. Thanks in Advance > Can anybody translate the C# code to VB.NET in this article? I translated it as such: > > Dim cm As CurrencyManager = Me.BindingContext(Me.DataGrid1.DataSource, Me.DataGrid1.DataMember) > > Dim dv As DataView = cm.List > > dv.AllowNew = False > > but when I run the form, the Append row still appears. > > Please send your response via email to [email protected] as well.


JN Johnny Nguyen September 8, 2003 03:40 PM UTC

I have a master-details datagrid with a single relations. I can make it work for the master grid BUT I can NOT make it works for the details grid. Can someone show me how to make it work for the detail grid. Thanks in Advance > > > > > Can anybody translate the C# code to VB.NET in this article? I translated it as such: > > > > Dim cm As CurrencyManager = Me.BindingContext(Me.DataGrid1.DataSource, Me.DataGrid1.DataMember) > > > > Dim dv As DataView = cm.List > > > > dv.AllowNew = False > > > > but when I run the form, the Append row still appears. > > > > Please send your response via email to [email protected] as well. >


MA Maddus October 20, 2003 10:37 AM UTC

The defaultview works,.. myDataTable.DefaultView.AllowNew = False myDataGrid.DataSource = myDataTable Greetings


MA Mathieu January 19, 2004 08:22 PM UTC

Where can i get this article? Am trying to do just this... in C# > Can anybody translate the C# code to VB.NET in this article? I translated it as such: > > Dim cm As CurrencyManager = Me.BindingContext(Me.DataGrid1.DataSource, Me.DataGrid1.DataMember) > > Dim dv As DataView = cm.List > > dv.AllowNew = False > > but when I run the form, the Append row still appears. > > Please send your response via email to [email protected] as well.

Loader.
Up arrow icon