Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Number rows in grid

Status
Not open for further replies.

HezMac

Programmer
Jan 14, 2004
56
CA
Hey

I was wondering if there's an easy way to number the rows in a grid.

I'm using SSultragrid, and would just like to have a number next to each row.

Seems simple enough, but can't find a "number" property to turn on for the grid...

Thanks for any suggestions.

 
What about adding an extra column and numbering it when the grid is populated with data?
 
vladk: What returns Row property? I'm not sure what you mean...
 
If anybody else is looking for this, here's what worked for me.

Code:
Private Sub NumberRows()

    Dim Row As SSRow
    Dim RowNum As Integer

    If gridPending.HasRows = True Then
    
        RowNum = 0
        
        Set Row = gridPending.GetRow(ssChildRowFirst)
        RowNum = RowNum + 1
        Row.Cells.Item("RowNum").Value = RowNum
        
        Do Until Not Row.HasNextSibling
          Set Row = Row.GetSibling(ssSiblingRowNext)
          RowNum = RowNum + 1
          Row.Cells.Item("RowNum").Value = RowNum
        Loop
    Else
        'do nothing
    End If

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top