M
Mike Fellows
Below is my code that is carried out on my dataset, datagrid etc...
Im trying to get column0 "Date & Time" to show date and time, not just date
ive read some stuff posted by Dmitriy Lapshin on this board that goes way
over my
ability (this is my first vb or vb.net project). from what I can tell i
need a GridColumnStyles
collection adding to my datagrid but each and everytime I try to do this my
code crashes.
It seems such a simple problem that is taking way too long to try and sort,
so any help would be greatly appreciated
Regards
Mike Fellows
da.SelectCommand = New OleDbCommand(SQLStr, ocon)
'Fill the DataSet with the Data
da.Fill(ds)
ds.Tables(0).Columns.Item(0).ColumnName = "Date & Time"
ds.Tables(0).Columns.Item(1).ColumnName = "Call Made By"
ds.Tables(0).Columns.Item(2).ColumnName = "Days Since RTB"
ds.Tables(0).Columns.Item(3).ColumnName = "Action"
ds.Tables(0).Columns.Item(4).ColumnName = "Price In"
ds.Tables(0).Columns.Item(5).ColumnName = "Property Valued"
ds.Tables(0).Columns.Item(6).ColumnName = "Notes"
Dim ts As New DataGridTableStyle()
ts.MappingName = "Table"
DataGrid1.TableStyles.Clear()
DataGrid1.TableStyles.Add(ts)
Me.DataGrid1.DataSource = ds.Tables(0)
ts.GridColumnStyles(0).Width = 90
ts.GridColumnStyles(1).Width = 90
ts.GridColumnStyles(2).Width = 100
ts.GridColumnStyles(3).Width = 90
ts.GridColumnStyles(4).Width = 90
ts.GridColumnStyles(5).Width = 90
ts.GridColumnStyles(6).Width = 250
RowCount = ds.Tables(0).Rows.Count
ColumnCount = ds.Tables(0).Columns.Count
da.Dispose()
ds.Dispose()
ocon.Close()
ocon.Dispose()
Im trying to get column0 "Date & Time" to show date and time, not just date
ive read some stuff posted by Dmitriy Lapshin on this board that goes way
over my
ability (this is my first vb or vb.net project). from what I can tell i
need a GridColumnStyles
collection adding to my datagrid but each and everytime I try to do this my
code crashes.
It seems such a simple problem that is taking way too long to try and sort,
so any help would be greatly appreciated
Regards
Mike Fellows
da.SelectCommand = New OleDbCommand(SQLStr, ocon)
'Fill the DataSet with the Data
da.Fill(ds)
ds.Tables(0).Columns.Item(0).ColumnName = "Date & Time"
ds.Tables(0).Columns.Item(1).ColumnName = "Call Made By"
ds.Tables(0).Columns.Item(2).ColumnName = "Days Since RTB"
ds.Tables(0).Columns.Item(3).ColumnName = "Action"
ds.Tables(0).Columns.Item(4).ColumnName = "Price In"
ds.Tables(0).Columns.Item(5).ColumnName = "Property Valued"
ds.Tables(0).Columns.Item(6).ColumnName = "Notes"
Dim ts As New DataGridTableStyle()
ts.MappingName = "Table"
DataGrid1.TableStyles.Clear()
DataGrid1.TableStyles.Add(ts)
Me.DataGrid1.DataSource = ds.Tables(0)
ts.GridColumnStyles(0).Width = 90
ts.GridColumnStyles(1).Width = 90
ts.GridColumnStyles(2).Width = 100
ts.GridColumnStyles(3).Width = 90
ts.GridColumnStyles(4).Width = 90
ts.GridColumnStyles(5).Width = 90
ts.GridColumnStyles(6).Width = 250
RowCount = ds.Tables(0).Rows.Count
ColumnCount = ds.Tables(0).Columns.Count
da.Dispose()
ds.Dispose()
ocon.Close()
ocon.Dispose()