Stop Datagrid allowing new Rows

I have a datgrid with  a table as the datasource.  

I would like to prevent the datagrid from having new rows added to it but still require the user to be able to edit the contents.  (stop the star row at the bottom)

I changed the datagrid to readonly however this stops editing completely even if i change the column style property to false


eg:
        .GridColumnStyles(6).ReadOnly = False
        .GridColumnStyles(7).ReadOnly = False

Thanks

matt
caffermAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
tovvenkiConnect With a Mentor Commented:
Hi,
The DataGrid class does not have a property that controls whether a new row can be added. But the DataView class does have such a property (along with some others such as AllowEdit and AllowDelete).
Dim cm As CurrencyManager
        cm = CType(Me.BindingContext(DataGrid1.DataSource, DataGrid1.DataMember), CurrencyManager)
        CType(cm.List, DataView).AllowNew = False
        CType(cm.List, DataView).AllowEdit = True

Regards,
venki
 
 
0
 
caffermAuthor Commented:
i don't know how it works by by jo it works

thanks very much!!!

Matt
0
 
geedub1961Commented:
Does this work even if not on a dataview?
0
All Courses

From novice to tech pro — start learning today.