Hi David,
First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you wants to make one of the
column in the datagrid readonly in VB.NET
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.
I think we can use the DataGridTableStyle and DataGridColumnStyle to do
the job.
Here is simple code snippet.
Dim ts As DataGridTableStyle
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'fill data into dataset11
Me.OleDbDataAdapter1.Fill(Me.DataSet11)
'add a new DataGridTableStyle
ts = New DataGridTableStyle
ts.MappingName = Me.DataSet11.Employees.TableName
Me.DataGrid1.TableStyles.Add(ts)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
'get the Address column and set its readonly property to true so that we
are not able to modify the Address column.
Dim cs As DataGridColumnStyle = ts.GridColumnStyles("Address")
cs.ReadOnly = True
End Sub
Please apply my suggestion above and let me know if it helps resolve your
problem.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.