Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Open form in the top right hand corner of screen

Posted on 2016-11-17
5
Medium Priority
?
94 Views
Last Modified: 2016-11-21
Hello,
How to ppen form in the top right hand corner of screen.
Cheers
0
Comment
Question by:RIAS
  • 3
  • 2
5 Comments
 
LVL 14

Accepted Solution

by:
Dustin Saunders earned 2000 total points
ID: 41891684
On your load event, change the position of the form to the screen area subtracting the width of the form.  Like:

Public Class Form1
    Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
        Dim scr = Screen.FromPoint(Me.Location)
        Me.Location = New Point(scr.WorkingArea.Right - Me.Width, scr.WorkingArea.Top)
        MyBase.OnLoad(e)
    End Sub
End Class

Open in new window

0
 

Author Comment

by:RIAS
ID: 41891695
Thanks Dustin,
Any suggestion on how to open on the right hand side of the other form .
Also, how to set form2 below form1

Cheers
0
 
LVL 14

Expert Comment

by:Dustin Saunders
ID: 41891765
You can just set the location of the form to a new point which would be to the right.

Form.Location = New Point(x,y)

Open in new window

This sets the location to whatever x or y position you want.  Just use whatever variable you want for the x position to place it where it should be.

If you place it staggered under the form you want to stay on top, then use Form.BringToFront() to make that form active (on top).
0
 

Author Comment

by:RIAS
ID: 41892753
Sorry, Dustin under means ,I meant below.
One below the other
0
 
LVL 14

Assisted Solution

by:Dustin Saunders
Dustin Saunders earned 2000 total points
ID: 41892967
If you want to open the form below the other, then you would get the location of the first form, then add the height of the form-- and set that as the location for the new one.

So,

Form2.Location = New Point(Form1.Location.X,Form1.Location.Y + Form1.Size.Height)

Open in new window

0

Featured Post

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Integration Management Part 2
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

971 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