Solved

Open form in the top right hand corner of screen

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HTTPS jquery doesn't work 9 63
export data table to excel in vb.net 10 27
write xml in vb.net 2 24
Adding bootstrap to only Content page and NOT master page 1 13
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

821 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