Solved

Open form in the top right hand corner of screen

Posted on 2016-11-17
5
35 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 12

Accepted Solution

by:
Dustin Saunders earned 500 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 12

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 12

Assisted Solution

by:Dustin Saunders
Dustin Saunders earned 500 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

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
Syntax error 9 45
Syntax Error 2 43
I need help making a collection from a class in VB.Net 3 23
Run a batch file when a Crystal Report is opened 5 12
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

914 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

14 Experts available now in Live!

Get 1:1 Help Now