• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 282
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

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