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

"...Praise should be given to the Forum managers or the Tipmasters - they are what make it work - give them extra recognition!!! They are timely (prompt - unlike ACTUAL support sites) and on the ball!!!..."

Geography

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

Visual Basic(Microsoft) -VB.NET FAQ

How-to

How to highlight Row In Windows Forms DataGrid control?
Posted: 11 Jun 03 (Edited 12 Jun 03)


In VS.NET, the DataGrid default selection property differs from the MS Flexigrid in VB 6. When a user clicks on a populated DataGrid in .NET, the cursor is placed inside the cell for editing. The following sample illustrates how to highlight the entire row when a user clicks on a cell. It calls the HitTest method on MouseUp event handler, which returns a DataGrid.HitTestInfo object that contains information about a part of the DataGrid clicked.  

Private Sub onDataGridMouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseUp
        Dim pt = New Point(e.X, e.Y)
        Dim hit As DataGrid.HitTestInfo = DataGrid1.HitTest(pt)

        If hit.Type = Windows.Forms.DataGrid.HitTestType.Cell Then
            DataGrid1.CurrentCell = New DataGridCell(hit.Row, hit.Column)
            DataGrid1.Select(hit.Row)
        End If
End Sub

If you find the sample useful, please don't forget to Rate this and other samples. Your feedback will be much appreciated and valued and will keep me triggering. GOOD LUCK!!!

Back to Visual Basic(Microsoft) -VB.NET FAQ Index
Back to Visual Basic(Microsoft) -VB.NET 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