Disabling Add Rows in a DataGrid in VB.net 
Author Message
 Disabling Add Rows in a DataGrid in VB.net

Hi all,

I have a form with a datagrid that I'd like the users to be able to
edit cells of.  However, I do not want the user to be able to add to
the datagrid by typing in the bottom row.  The only property I can
find on the datagrid that deals with this is the Read Only property.
If I set that to false, it limits the user from adding rows, however
they obviously can not edit the cells.

Does anyone have any idea on how to turn off the add row feature on
the datagrid object?

Thanks
-Mike



Mon, 30 Aug 2004 03:56:36 GMT  
 Disabling Add Rows in a DataGrid in VB.net
I was with the same problem as you and i fixed it setting the propertie
.AllowNew = False on the DataView...
Im not sure if you have a dataview, i hope yes... here is my code anyway.

    Dim dt As New DataTable()
    dt = rsDC.Tables(0)
    dt.TableName = "Notes"
    Dim dv As DataView = New DataView(dt)
    dv.AllowNew = False
    dv.AllowEdit = False
    DataGrid1.DataSource = dv

Hope it help...


Quote:
> Hi all,

> I have a form with a datagrid that I'd like the users to be able to
> edit cells of.  However, I do not want the user to be able to add to
> the datagrid by typing in the bottom row.  The only property I can
> find on the datagrid that deals with this is the Read Only property.
> If I set that to false, it limits the user from adding rows, however
> they obviously can not edit the cells.

> Does anyone have any idea on how to turn off the add row feature on
> the datagrid object?

> Thanks
> -Mike



Mon, 30 Aug 2004 04:07:09 GMT  
 Disabling Add Rows in a DataGrid in VB.net

Worked like a champ... thanks a bunch.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Mon, 30 Aug 2004 05:56:50 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. asp.net DataGrid adding an extra Header Row

2. Add row to datatable from datagrid without leaving current row with cursor

3. Delete a row in a Datagrid using VB.net

4. VB.NET DataGrid Row Colors

5. VB.NET datagrid and the append row

6. Access and vb.net row adding

7. Adding a row to access database in vb.net

8. Adding a row to Access database using VB.Net

9. Disable Delete row function in Datagrid

10. Datagrid : How to disable rows?

11. Datagrid and Rows.Add

12. datagrid - catching whether editing or adding a new row

 

 
Powered by phpBB® Forum Software