CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2008
    Posts
    38

    Loop through the value in Datagrid

    Hi,

    I have to loop through each record in the Datagrid irrespective of the recordset.

    Please help me.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Loop through the value in Datagrid

    Either the grid is bound to the data, or it is unbound. If the latter, you should have your recordset in memory, so looping thru a collection or array is the answer
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: Loop through the value in Datagrid

    In the DataGrid the rows are your records.
    So if you want to iterate through the rows You can dO:
    Code:
      Dim i%
      For i=0 (or 1 if you have a fixed row) To Grid.Rows
            'do something with the row
            'for instance Grid.TextMatrix(i, 0) is the text in column 0 of each row.
      Next
    At least that applies for the MSHFlexGrid. I think DataGrid is the same in this respect.

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

Featured