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

datagrid cell readonly posible?

P: n/a
JJ
Hi

does anyone know how to make a datagrid CELL readonly
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,

Add a tablestyle to a grid. Set the datagridtextboxcolumn readonly
property to false.
Private Sub SetupGrid()

Dim ts As New DataGridTableStyle

ts.MappingName = "Categories"

Dim colPhoto As New DataGridTextBoxColumn

With colPhoto

..MappingName = "Picture"

..HeaderText = "Photo"

..Width = 150

End With

Dim colName As New DataGridTextBoxColumn

With colName

..MappingName = "CategoryName"

..HeaderText = "Name"

..Width = 80

End With

Dim colDescription As New DataGridTextBoxColumn

With colDescription

..MappingName = "Description"

..HeaderText = "Description"

..Width = 80

..ReadOnly = True

End With

ts.GridColumnStyles.Add(colPhoto)

ts.GridColumnStyles.Add(colName)

ts.GridColumnStyles.Add(colDescription)

DataGrid1.TableStyles.Add(ts)

ts = Nothing

colDescription = Nothing

colName = Nothing

colPhoto = Nothing

End Sub

Ken
-------------------------
"JJ" <ji********@hotmail.com> wrote in message
news:CA**********************************@microsof t.com...
Hi,

does anyone know how to make a datagrid CELL readonly?

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.