Solved

cannot access a disposed object named datagridtextbox

Posted on 2007-11-16
6
263 Views
Last Modified: 2010-04-23
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
Comment
Question by:running32
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 20299159
Is 'hit' Nothing when you click on the grey area?

Bob
0
 

Author Comment

by:running32
ID: 20299240
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
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 20299374
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:running32
ID: 20299442
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 20300146
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
 

Author Comment

by:running32
ID: 20464456
Thank you for the help.  I have it working now.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question