A
-Alex
I have snipped the following code from an example only to find that it
apparently doesn't work with regard to comlun sizing. I have been wrestling
with this to no avail.
The dataset is filled with the expected data but the size is wrong.
Whenever I run with the code below numeric fields have a size of 1, vchar
fields a size of 5 and date fields a size of 2.
If I comment the column.width statements they all seem to default to about a
size of 12.
Can anyone twist my head in the right direction?
Thanks,
-Alex
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.SqlDataAdapter1.Fill(Me.DataSet11)
'Step 1: Create a DataGridTableStyle &
' set mappingname to table.
Dim tableStyle As New DataGridTableStyle
tableStyle.MappingName = "Clinics"
'Step 2: Create DataGridColumnStyle for each col
' we want to see in the grid and in the
' order that we want to see them.
'Step 2: ClinincID
Dim column As New DataGridTextBoxColumn
column.MappingName = "ClinicID"
column.HeaderText = "Clinic ID"
column.Width = 12
tableStyle.GridColumnStyles.Add(column)
'Step 2: ClinicName
column = New DataGridTextBoxColumn
column.MappingName = "ClinicName"
column.HeaderText = "Clinic Name"
column.Width = 30
tableStyle.GridColumnStyles.Add(column)
'Step 2: Administrator
column = New DataGridTextBoxColumn
column.MappingName = "Administrator"
column.HeaderText = "Administrator"
column.Width = 30
tableStyle.GridColumnStyles.Add(column)
'Step 2: ActivityCount
column = New DataGridTextBoxColumn
column.MappingName = "ActivityCount"
column.HeaderText = "Activity Count"
column.Width = 12
tableStyle.GridColumnStyles.Add(column)
'Step 2: LastActivityDateTime
column = New DataGridTextBoxColumn
column.MappingName = "LastActivityDateTime"
column.HeaderText = "Last Activity"
column.Width = 15
tableStyle.GridColumnStyles.Add(column)
'Step 3: Add the tablestyle to the datagrid
Me.DataGrid1.TableStyles.Add(tableStyle)
End Sub
apparently doesn't work with regard to comlun sizing. I have been wrestling
with this to no avail.
The dataset is filled with the expected data but the size is wrong.
Whenever I run with the code below numeric fields have a size of 1, vchar
fields a size of 5 and date fields a size of 2.
If I comment the column.width statements they all seem to default to about a
size of 12.
Can anyone twist my head in the right direction?
Thanks,
-Alex
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.SqlDataAdapter1.Fill(Me.DataSet11)
'Step 1: Create a DataGridTableStyle &
' set mappingname to table.
Dim tableStyle As New DataGridTableStyle
tableStyle.MappingName = "Clinics"
'Step 2: Create DataGridColumnStyle for each col
' we want to see in the grid and in the
' order that we want to see them.
'Step 2: ClinincID
Dim column As New DataGridTextBoxColumn
column.MappingName = "ClinicID"
column.HeaderText = "Clinic ID"
column.Width = 12
tableStyle.GridColumnStyles.Add(column)
'Step 2: ClinicName
column = New DataGridTextBoxColumn
column.MappingName = "ClinicName"
column.HeaderText = "Clinic Name"
column.Width = 30
tableStyle.GridColumnStyles.Add(column)
'Step 2: Administrator
column = New DataGridTextBoxColumn
column.MappingName = "Administrator"
column.HeaderText = "Administrator"
column.Width = 30
tableStyle.GridColumnStyles.Add(column)
'Step 2: ActivityCount
column = New DataGridTextBoxColumn
column.MappingName = "ActivityCount"
column.HeaderText = "Activity Count"
column.Width = 12
tableStyle.GridColumnStyles.Add(column)
'Step 2: LastActivityDateTime
column = New DataGridTextBoxColumn
column.MappingName = "LastActivityDateTime"
column.HeaderText = "Last Activity"
column.Width = 15
tableStyle.GridColumnStyles.Add(column)
'Step 3: Add the tablestyle to the datagrid
Me.DataGrid1.TableStyles.Add(tableStyle)
End Sub