DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: DataGrid

  1. #1
    Join Date
    Oct 2004
    Posts
    101

    DataGrid

    Hello,

    How to move to first row in Datagrid?
    i tried like

    DataGrid1.row = 0

    but, if there is scroll bar its not moving to first row.

    i need to show the very first row in the grid.


    Arjun
    sp

  2. #2
    Join Date
    Dec 2003
    Posts
    2,750
    Have you tried using the Scroll method of the DataGrid?
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

  3. #3
    Join Date
    Oct 2004
    Posts
    101

    But......

    Hello pclement,

    I tried now but its not giving the correct results.

    actually i want to check a value which is equl to grids value.

    if there is a scroll bar its not giving the correct value....

    Can u help me.... do u another way.

    S.Arjun..

    eg:
    grdSch is the grid
    intS is an interger - counting purpose

    For intLoop = 0 To grdSch.ApproxCount

    grdSch.Row = intLoop

    If Trim(grdSch.Columns(1).Text) = "S"
    Then
    intS = intS + 1

    End If

    next intLoop
    sp

  4. #4
    Join Date
    Dec 2003
    Posts
    2,750
    I don't think I understand your question. Are you trying to locate a specific value in the DataGrid?
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

  5. #5
    Join Date
    Dec 2004
    Posts
    3
    You can manipulate a datagrid by manipulating the recordset that you filled it with (if that's how you did it).

    If you've retrieved data from a database by using a recordset and then set the source of the datagrid as this recordset -

    recordset1.open(someSqlhere)

    set datagrid1.source = recordset1

    - then you can move to the first position in the datagrid by saying:

    recordset1.moveFirst


    The focus of your datagrid will automatically follow the position of the current record in the recordset.

    Similarly you can get the current position by querying the recordset1.absolutePosition property.

    Working with the row property of datagrids is a pain because it gives the row number calculated from the first visible row on the screen, i.e. if you have a datagrid with 50 rows and only 10 are visible on the screen then the first row that you can see will be row number 1 but the actual position could be anything from 0 to 40. Best to stick with the recordset (again, if that's how you filled your datagrid).

    Hope this helps

  6. #6
    Join Date
    Oct 2004
    Posts
    101

    But....

    Hi,

    I need to check how many "S" are there in the grid. which are entered by the user. After that i want to save the grids value in to databae. I have created a table like grid.

    Arjun.
    sp

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center