Hi,
Your tablestyle mapping name is probably wrong that is why the bool
column is not readonly
ts.MappingName = tGrn.Tablename
Prevent the add new line
tGrn.DefaultName.allownew=false
Ken
------------------
[quoted text, click to view] <Edmond> wrote in message news:upaUajykFHA.1412@TK2MSFTNGP09.phx.gbl...
Dear all,
I have a question about check box in datagrid. How can set the checkbox
is readonly in datagrid.?..
here is the code:
Dim tGrn As DataTable
Dim Colgrn As DataColumn
Dim Grndataset As New DataSet
Colgrn = New DataColumn
Colgrn.DataType = System.Type.GetType("System.Boolean")
Colgrn.ColumnName = "complete"
tGrn.Columns.Add(Colgrn)
Dim ts As New DataGridTableStyle
Dim cs1 As DataGridColumnStyle
cs1 = New DataGridBoolColumn
cs1.Width = 58
cs1.MappingName = "complete"
cs1.HeaderText = "Complete"
cs1.NullText = 0
cs1.ReadOnly = True <- Even set ReadOnly....but still
can click the checkbox ->
ts.GridColumnStyles.Add(cs1)
ts.MappingName = "tGrn"
grngrid.TableStyles.Add(ts)
grngrid.DataSource = tGrn
Grndataset.Tables.Add(tGrn)
also how can protect the datagrid..that not allow user add line again...
for example: I already have 10 records in datagrid...which have 3 column..
product code, product name and QTY.
I want to do that..not allow user to add line again but still can let user
to modify the QTY.
Thanks so much
Edmond