A
Angelina
Hi,
Im trying to format my datagrid via some code to make one
column readonly while the other can be edited.
I also tried to change the column header. The problem is
that the code does not seem to be taking effect.
Here is my code. Can anyone please offer me some help?
da = New SqlDataAdapter("SELECT Equipment_Desc, 0 as
Quantity FROM Equipment_Details", Cn)
ds = New DataSet("Equipment")
da.Fill(ds)
DataGridEquip.DataSource = ds.Tables(0)
Dim TSEquip As New DataGridTableStyle()
TSEquip.MappingName = "Equipment"
Dim TCEquipName As New DataGridTextBoxColumn()
TCEquipName.MappingName = "Equipment_Desc"
TCEquipName.HeaderText = "Equipment Name"
TCEquipName.Width = 110
TCEquipName.ReadOnly = True
TSEquip.GridColumnStyles.Add(TCEquipName)
Dim TCQuantity As New DataGridTextBoxColumn()
TCQuantity.MappingName = "Quantity"
TCQuantity.HeaderText = "Quantity"
TCQuantity.Width = 90
TCQuantity.ReadOnly = False
TSEquip.GridColumnStyles.Add(TCQuantity)
DataGridEquip.TableStyles.Add(TSEquip)
Im trying to format my datagrid via some code to make one
column readonly while the other can be edited.
I also tried to change the column header. The problem is
that the code does not seem to be taking effect.
Here is my code. Can anyone please offer me some help?
da = New SqlDataAdapter("SELECT Equipment_Desc, 0 as
Quantity FROM Equipment_Details", Cn)
ds = New DataSet("Equipment")
da.Fill(ds)
DataGridEquip.DataSource = ds.Tables(0)
Dim TSEquip As New DataGridTableStyle()
TSEquip.MappingName = "Equipment"
Dim TCEquipName As New DataGridTextBoxColumn()
TCEquipName.MappingName = "Equipment_Desc"
TCEquipName.HeaderText = "Equipment Name"
TCEquipName.Width = 110
TCEquipName.ReadOnly = True
TSEquip.GridColumnStyles.Add(TCEquipName)
Dim TCQuantity As New DataGridTextBoxColumn()
TCQuantity.MappingName = "Quantity"
TCQuantity.HeaderText = "Quantity"
TCQuantity.Width = 90
TCQuantity.ReadOnly = False
TSEquip.GridColumnStyles.Add(TCQuantity)
DataGridEquip.TableStyles.Add(TSEquip)