Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Open form at location over a TreeView

Posted on 2014-10-14
2
Medium Priority
?
121 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:Murray Brown
[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 2000 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:Murray Brown
ID: 40389205
thanks
0

Featured Post

Independent Software Vendors: 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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

670 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