Results 1 to 6 of 6

Thread: Grid - Determining Number of Rows

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2002
    Location
    New Zealand
    Posts
    78

    Grid - Determining Number of Rows

    I'm using a grid (SSUltraGrid) to display a query result and then I'm writing the values inside the grid into a String seperated by returns and then writing it into the database.

    The problem I'm finding is that I need to know the number of rows so that I can loop through all the cells as the query result isn't going to always have the same number of rows. How can I determine the number of rows in a grid? With the attached graphic it has 5 rows and I can successfully read that into a string by making the loop from 1 to 5 but I need it to be dymanic.

    Also, when I write to the database with it seperated by returns I need to be able to re-open it displaying the results in the grid. Again, I would need to know the number of rows so I can loop through correctly.

    Does anyone have any ideas?
    Attached Images Attached Images  

  2. #2
    Frenzied Member McGenius's Avatar
    Join Date
    Jan 2003
    Posts
    1,199
    It must have some property such:
    SSUltraGrid.Rows or
    SSUltraGrid.Rows.Count or something like that ... Most of the grids do have ...
    McGenius

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2002
    Location
    New Zealand
    Posts
    78
    Nope

    Nothing like:

    SSUltraGrid.Rows or
    SSUltraGrid.Rows.Count

  4. #4
    Frenzied Member McGenius's Avatar
    Join Date
    Jan 2003
    Posts
    1,199
    Hmm, weird control. Why can't you use FlexGrid - I know it's far from being perfect but at least you can get what you need ...
    McGenius

  5. #5
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    If you're doing a query to fill the grid, surely the recordset has a "RecordCount" or equivelant property,
    else couldn't you just get a record count as part of an SQL statement?
    VB Code:
    1. SELECT COUNT(*) FROM TableName

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Nov 2002
    Location
    New Zealand
    Posts
    78
    Thanks Aaron. I've now got the values in the Grid writing into a string like this:

    VB Code:
    1. 111   222   333   444   555  
    2. 123   234   345   456   567  
    3. 001   002   003   004   005  
    4. 101   202   303   404   505

    seperated by tabs and returns that I'm writing into a field in the database.

    Obviously when I read it back out from the database I'm going to have to know the number of rows to write it back into the grid. Should I save the "RecordCount" value into a field in the database or is there a better way?

    Thanks for your help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width