INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Visual Basic (Microsoft) Versions 5/6 FAQ

DB Grid : Row Number

How to get the selected row number from a DB Grid? by ameen
Posted: 6 Jul 01

To get the row number, when you want to double click any of the cell in the DB Grid:
Step 1:
Declare a variable in the General section:
   Dim nRow as Integer
Then
Step 2:
   Private Sub DBGrid1_MouseDown(Button As Integer, _
                Shift As Integer, X As Single, Y As Single)
          ' To get the selected row
            nRow = DBGrid1.RowContaining(Y)
   End Sub

Step 3:
   Private Sub DBGrid1_DblClick()
   .Use Message Box to display the row number by reffering nRow
   End Sub


When you want to use recordset object, put this line in the click event of first, last, previous and next button of the form.
  nRow = Data1.Recordset.AbsolutePosition
Use this nRow to display the value or you can perform any other process which you want to do.

Back to Visual Basic (Microsoft) Versions 5/6 FAQ Index
Back to Visual Basic (Microsoft) Versions 5/6 Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close