Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
170
InitializeRow and e.Row.Index = -1?
posted

I am trying to change the color of a Row based on a value, which works perfectly.  Except I need to change the row above this row as well, and this works on the first refresh of the grid, but subsequent refreshes it doesn't work because e.Row.Index is not the index but -1.

This is the code I am using:

 Me.grd_Main.Rows(e.Row.Index - 1).Appearance.BackColor = cClosedControllerBlue

Any ideas why it works the first time and not subsequently?

Thanks

M

  • 469350
    Verified Answer
    Offline posted

    Hi M,

        Is the Index actually -1? Or is the Index 0 and it comes out -1 when you subtract one from it. I can't see any reason why any row in the grid would ever return -1 for it's Index.