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
Solved

Open form at location over a TreeView

Posted on 2014-10-14
2
115 Views
Last Modified: 2014-10-18
Hi

I am trying to open a windows form at a point over a TreeView
How do I do this?
I tried using the following line to load my form at the point where my mouse is but that didn't work
 Form1.Location = Me.PointToClient(System.Windows.Forms.Cursor.Position)
Form1.show
0
Comment
Question by:murbro
2 Comments
 
LVL 25

Accepted Solution

by:
SStory earned 500 total points
ID: 40380942
    Private Sub TreeView1_MouseUp(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseUp
        Dim f As New Form2
        f.StartPosition = FormStartPosition.Manual
        f.Location = f.PointToScreen(New Point(Me.Location.X + e.X, Me.Location.Y + e.Y))
        f.Show()

    End Sub

Open in new window


You have to be sure to set FormStartPosition to Manual. You'll also probably want to declare the second form variable at the module level, but this should do it.
0
 

Author Closing Comment

by:murbro
ID: 40389205
thanks
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

856 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