Dean, you are the man! That worked. By the way, I rewrote this without the For Next loop so I removed the Exit For line.
Thanks, Bob -------------- Original message -------------- From: "Dean Fiala" <[EMAIL PROTECTED]> Bob, RowState is a Flag enumeration http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.datacontrolrowstate.aspx you need to do a little bitwise logic If ( ri.RowState And DataControlRowState.Selected) <> 0 Then 'Do something End if Also note that since you have an Exit For in your If...Then statement, you will only ever find the first selected row. On 5/9/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hi all, > > I am having problems with this code: > > For Each ri In gvGameStats.Rows > If ri.RowState = DataControlRowState.Selected Then > CType(ri.FindControl("txABCs"), TextBox).Text = CType(ri.FindControl("txHRs"), > TextBox).Text + 1 > Exit For > End If > Next > > In another part of my code, I make the next row in my gridview as the > selected row. This seems to work since my backcolor changes to the color I > use for the SelectedRowStyle-BackColor property. I want to check each row > and see if it is selected. This works great for the first row but on every > other row the rowstate = 3 which means it is an alternate row. Is there any > way to to check each row and see if it is selected whether it is an > alternate row or not? > > Thanks, > Bob > > [Non-text portions of this message have been removed] > > > -- Dean Fiala Very Practical Software, Inc Now with Blogging... http://www.vpsw.com/blogbaby Microsoft MVP [Non-text portions of this message have been removed] [Non-text portions of this message have been removed]

