By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,168 Members | 2,599 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,168 IT Pros & Developers. It's quick & easy.

Datagrid Question

P: n/a
Hi,

I have a datagrid in a VB.NET form with a set number of rows that the
user is required to fill out. But I don't want to allow the user to
add or delete rows from the datagrid. The only way I have found to do
disable this functionality is to set datagrid.ReadOnly or
datagrid.Locked equal to true - but when I do this, the user isn't
able to change the information in the cells. Is there some way to
disable the add/delete row functionality for the datagrid but leave
the editing functionality intact?

Joy
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

<si***********@yahoo.com> schrieb
I have a datagrid in a VB.NET form with a set number of rows that the
user is required to fill out. But I don't want to allow the user to
add or delete rows from the datagrid. The only way I have found to do
disable this functionality is to set datagrid.ReadOnly or
datagrid.Locked equal to true - but when I do this, the user isn't
able to change the information in the cells. Is there some way to
disable the add/delete row functionality for the datagrid but leave
the editing functionality intact?


Hi Joy,

have a look at the example given here:
http://www.syncfusion.com/FAQ/WinFor...c44c.asp#q653q

and add:

((DataView)cm.List).AllowDelete = false;

Cheers

Arne Janning
Nov 21 '05 #2

P: n/a

Thank you! But do you have a version of that code in VB.NET?? I am
struggling to convert it from C# to VB.NET.


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

P: n/a
"Joy Labadie" <si***********@yahoo.com> schrieb

Thank you! But do you have a version of that code in VB.NET?? I am
struggling to convert it from C# to VB.NET.


Dim connString as String = "Provider=Microsoft.JET.OLEDB.4.0;data
source=C:\northwind.mdb"
Dim sqlString as String = "SELECT * FROM customers"
Dim connection as OleDbConnection = _
new OleDbConnection(connString)
Dim dataAdapter as OleDbDataAdapter = _
new OleDbDataAdapter(sqlString, connection)
Dim ds as DataSet = new DataSet()
dataAdapter.Fill(ds, "customers")
dataGrid1.DataSource = ds.Tables("customers")
Dim cm as CurrencyManager = CType(me.BindingContext( _
dataGrid1.DataSource, dataGrid1.DataMember), _
CurrencyManager)
DirectCast(cm.List, DataView).AllowNew = False
DirectCast(cm.List, DataView).AllowDelete = False

Cheers

Arne Janning
Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.