• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 289
  • Last Modified:

cannot access a disposed object named datagridtextbox

When I click on the datagrid on my form in the text areas it will navigate but if I click on the grey area next to it I get the message cannot access a disposed object named datagridtextbox.  Can someone tell me why it will not navigate when you click on the grey area of the row.

It appears that is pt does not have a value when I click the grey area next to the line.
        Dim pt = New Point(e.X, e.Y)

        Dim hti As DataGrid.HitTestInfo = DataGrid2.HitTest(pt)

        If hti.Type = DataGrid.HitTestType.Cell Then


thanks
0
running32
Asked:
running32
  • 3
  • 3
1 Solution
 
Bob LearnedCommented:
Is 'hit' Nothing when you click on the grey area?

Bob
0
 
running32Author Commented:
Good morning Bob,

Yes, when I step through hti is  = Nothing and pt is = Nothing when pt = {System.drawing.point} and hti = pt = {System.Windows.Forms.Datagrid.HitTestInfo}
0
 
Bob LearnedCommented:
Try something like this then.

Bob


Dim pt = New Point(e.X, e.Y)
Dim hti As DataGrid.HitTestInfo = DataGrid2.HitTest(pt)
If hti IsNot Nothing AndAlso hti.Type = DataGrid.HitTestType.Cell Then
End If

Open in new window

0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
running32Author Commented:
I still need it to read the line that is clicked.  Does vb.net not reconize the line that is clicked inside the datagrid unless it is in the white area?  Thanks
0
 
Bob LearnedCommented:
I haven't used the DataGrid in a long time, but my first inclination is you need to click on the DataGrid where it responds as expected.

Bob
0
 
running32Author Commented:
Thank you for the help.  I have it working now.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now