Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

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

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Thanks for a great forum. My problem was answered just by scrolling through previously solved problems. Great service!!..."

Geography

Where in the world do Tek-Tips members come from?

Visual Basic(Microsoft): Version 5 & 6 FAQ

DB Grid : Row Number

How to get the selected row number from a DB Grid?
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): Version 5 & 6 FAQ Index
Back to Visual Basic(Microsoft): Version 5 & 6 Forum

My Archive

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