Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataGrid cursor change

Status
Not open for further replies.

jpinto

Technical User
Dec 12, 2003
75
PT
Hello,

I've a DataGrid on a form and I need to change the cursor from Default to Help when a user moves the mouse over a certain column of the DataGrid. I've the following code but is not working:

Code:
Private Sub DataGridView1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.MouseHover
        If DataGridView1.CurrentCell.ColumnIndex = 7 Then
            DataGridView1.Cursor = Cursors.Help
        End If
    End Sub

The error message that I receive is:

"Object reference not set to an instance of an object"

Can annyone help please?

Thanks,

João Pinto
 
I supose that is because currentcell is the one that is selected not the one you are hovering over.

perhaps there is something in the eventargs.

Christiaan Baes
Belgium

"My new site" - Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top