I want will change name and width colums on DataGrid. Has written the following code all on rules.
Works up to a point 1, but does not want will change columns
Ani ideas?
Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
dt.Columns.Add(New DataColumn("Col0", GetType(Integer)))
dt.Columns.Add(New DataColumn("Col1", GetType(String)))
dt.Columns.Add(New DataColumn("Col2", GetType(Double)))
Dim i As Integer
For i = 0 To 8
dr = dt.NewRow()
dr(0) = i
dr(1) = "Name" & i.ToString
dr(2) = 10 * i
dt.Rows.Add(dr)
Next i
DataGrid1.DataSource = dv
1.
Dim tableStyle As New DataGridTableStyle
tableStyle.MappingName = "Artikuli"
Dim discontinuedCol As New DataGridBoolColumn
discontinuedCol.MappingName = "Check"
discontinuedCol.HeaderText = ""
discontinuedCol.Width = 50
discontinuedCol.AllowNull = False
tableStyle.GridColumnStyles.Add(discontinuedCol)
Dim column As New DataGridTextBoxColumn
column.MappingName = "ID"
column.HeaderText = "ID"
column.Width = 100
tableStyle.GridColumnStyles.Add(column)
column = New DataGridTextBoxColumn
column.MappingName = "Name"
column.HeaderText = "Name"
column.Width = 1000
tableStyle.GridColumnStyles.Add(column)
column = New DataGridTextBoxColumn
column.MappingName = "Price"
column.HeaderText = "Price"
column.Width = 300
tableStyle.GridColumnStyles.Add(column)
DataGrid1.TableStyles.Add(tableStyle)
End Sub
Miho
Works up to a point 1, but does not want will change columns
Ani ideas?
Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
dt.Columns.Add(New DataColumn("Col0", GetType(Integer)))
dt.Columns.Add(New DataColumn("Col1", GetType(String)))
dt.Columns.Add(New DataColumn("Col2", GetType(Double)))
Dim i As Integer
For i = 0 To 8
dr = dt.NewRow()
dr(0) = i
dr(1) = "Name" & i.ToString
dr(2) = 10 * i
dt.Rows.Add(dr)
Next i
DataGrid1.DataSource = dv
1.
Dim tableStyle As New DataGridTableStyle
tableStyle.MappingName = "Artikuli"
Dim discontinuedCol As New DataGridBoolColumn
discontinuedCol.MappingName = "Check"
discontinuedCol.HeaderText = ""
discontinuedCol.Width = 50
discontinuedCol.AllowNull = False
tableStyle.GridColumnStyles.Add(discontinuedCol)
Dim column As New DataGridTextBoxColumn
column.MappingName = "ID"
column.HeaderText = "ID"
column.Width = 100
tableStyle.GridColumnStyles.Add(column)
column = New DataGridTextBoxColumn
column.MappingName = "Name"
column.HeaderText = "Name"
column.Width = 1000
tableStyle.GridColumnStyles.Add(column)
column = New DataGridTextBoxColumn
column.MappingName = "Price"
column.HeaderText = "Price"
column.Width = 300
tableStyle.GridColumnStyles.Add(column)
DataGrid1.TableStyles.Add(tableStyle)
End Sub
Miho