Solved

Open form at location over a TreeView

Posted on 2014-10-14
2
117 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
[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
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

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!

Question has a verified solution.

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

Suggested Solutions

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

756 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