cancel
Showing results for 
Search instead for 
Did you mean: 

Grid Fore Color

0 Kudos
499

Hi All

I am trying to change the fore color of a row in the grid depending on some condition.I load my grid data on result of a query.Now i loop through the grid and want to change the forecolor ,I am getting error

Row - Invalid index [66000-31]

For i As Integer = 0 To oGrid.Rows.Count - 1 
 oEdit1.Value = oGrid.DataTable.GetValue("img", oGrid.GetDataTableRowIndex(i)) 
 If oEdit1.Value = "+" Then
Dim newColor As Integer = 16777088 
 oGrid.CommonSetting.SetRowFontColor(i, newColor)
end if

next i

Also tried ogrid .getdatatablerowindex(i) instead of i but getting same error

Row - Invalid index [66000-31]

For i As Integer = 0 To oGrid.Rows.Count - 1 
 oEdit1.Value = oGrid.DataTable.GetValue("img", oGrid.GetDataTableRowIndex(i)) 
 If oEdit1.Value = "+" Then
Dim newColor As Integer = 16777088 
 oGrid.CommonSetting.SetRowFontColor(oGrid.GetDataTableRowIndex(i), newColor)
end if

next i


PLEASE HELP TIA

Accepted Solutions (1)

Accepted Solutions (1)

ronilson36
Discoverer
0 Kudos

Hello Dear,

It's very easy to solve its, let me explain you.

For the method oGrid.CommonSetting.SetRowBackColor the first line is 1

For the method oGrid.DataTable.GetValue the first line is 0

So for fix your problem just use +1 for change the forecolor.

check the code below:

For i As Integer = 0 To oGrid.Rows.Count - 1 
 Dim var As String = oGrid.DataTable.GetValue("img", i) 
  If var = "+" Then
    Dim newColor As Integer = 16777088 
    oGrid.CommonSetting.SetRowFontColor((i+1), newColor) 
  end if
next i

Good Luck.

Answers (1)

Answers (1)

0 Kudos

thank you so much sir