Solved

cannot access a disposed object named datagridtextbox

Posted on 2007-11-16
6
237 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AutoHotkey ActiveX Component Error 8 71
Create XML 5 46
More on Time zones in vb 2010 12 37
Write to file when application closes (by logoff) - VB.NET 1 20
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now