J
Jim Mirra
Hey,
I have been working on this for a while now and I keep getting the same
error.
here is my code:
------- start code ---------
Dim strSQL = "Select tagid,itemid,description,status, transtype, (select
max(datetime) from transactions where tagid = inventory.tagid) as statusdate
from inventory"
Dim connect as new SqlConnection([Sql Connection Stringgoes here])
connect.open()
Dim ds as New DataSet
Dim da as New DataAdapter(strSQL, connect)
da.Fill(ds, "Inventory")
da.FillSchema(ds.Tables("Inventory"), SchemaType.Source)
DataGrid1.DataSource = ds.Tables("Inventory")
DataGrid1.TableStyles.Clear()
Dim objTblStyle as DataGridTableStyles = new DataGridTableStyles()
objTblStyle.MappingName = "Inventory"
Dim objGridColStyles as GridColumnStylesCollection
objGridColStyles = objTblStyle.GridColumnStyles
DataGrid1.TableStyles.Add(objTblStyle)
DataGrid1.TableStyles("Inventory").AlternatingBackColor = Color.LightGray
DataGrid1.TableStyles("Inventory").GridColumnStyles(0).Width = 150
------- end code --------
If I comment the last line of the code the code executes and the alternating
backcolors work.
with the last line uncommented, i get an Index Out of Range Error
and if i replace the (0) with ("tagid") or the name of another column I get
an Item not set to an instance of object error.
any help would be greatly appreciated.
Thanks,
Jim
I have been working on this for a while now and I keep getting the same
error.
here is my code:
------- start code ---------
Dim strSQL = "Select tagid,itemid,description,status, transtype, (select
max(datetime) from transactions where tagid = inventory.tagid) as statusdate
from inventory"
Dim connect as new SqlConnection([Sql Connection Stringgoes here])
connect.open()
Dim ds as New DataSet
Dim da as New DataAdapter(strSQL, connect)
da.Fill(ds, "Inventory")
da.FillSchema(ds.Tables("Inventory"), SchemaType.Source)
DataGrid1.DataSource = ds.Tables("Inventory")
DataGrid1.TableStyles.Clear()
Dim objTblStyle as DataGridTableStyles = new DataGridTableStyles()
objTblStyle.MappingName = "Inventory"
Dim objGridColStyles as GridColumnStylesCollection
objGridColStyles = objTblStyle.GridColumnStyles
DataGrid1.TableStyles.Add(objTblStyle)
DataGrid1.TableStyles("Inventory").AlternatingBackColor = Color.LightGray
DataGrid1.TableStyles("Inventory").GridColumnStyles(0).Width = 150
------- end code --------
If I comment the last line of the code the code executes and the alternating
backcolors work.
with the last line uncommented, i get an Index Out of Range Error
and if i replace the (0) with ("tagid") or the name of another column I get
an Item not set to an instance of object error.
any help would be greatly appreciated.
Thanks,
Jim