MyTable.BackColor = Color.Red
But I can't seem to do a table cell. I have tried this:
MyTable.Rows(1).Cells(1).BackColor = Color.Blue
With this I get the error:
"Specified argument was out of the range of valid values. Parameter name: index "
I have tried inheriting the namespace "System.Drawing"
Can this be done, if so how? If not, how would I do this normally with VB?
ThanksThis means that the row or cell does not exist. Namely, the index of the first row in table is 0, not 1. Same goes for the cells.
So if you have only one row and only one cell, you get an error.
Try
MyTable.Rows(0).Cells(0).BackColor = Color.Blue
I looked back on it and adjusted my code to row 0 and cell 0. I can now get the row to change color, but regardless of what cell I call, it changes the entire row. I tried putting an entry for two cells in the same row, but it just ignores the anything after the first call. Any ideas?
0 comments:
Post a Comment