JLE
  • JLE
  • Newbie Topic Starter
2013-09-22T07:57:18Z
the code
IGrid1.Cols.Add("Col1")
IGrid1.Cols.Add("Col2")
IGrid1.Rows.Add()
IGrid1.Cells(0, 0).Value = "OK"
IGrid1.Cells(0, "Col1").Value = "ERROR"

this line causes the error "Invalid key"
As would use the column name to assign to the cell value?
thanks
Igor/10Tec
2013-09-24T07:34:08Z
You used an improper version of the Add method. You call the iGColCollection.Add(text As String) version in which you specify only the column header text. What you need is the iGColCollection.Add(key As String, text As String) overloaded version:

IGrid1.Cols.Add("Col1", "Col1")
IGrid1.Cols.Add("Col2")
IGrid1.Rows.Add()
IGrid1.Cells(0, 0).Value = "OK"
IGrid1.Cells(0, "Col1").Value = "ERROR"