Solved

Open form in the top right hand corner of screen

Posted on 2016-11-17
5
60 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
[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
  • 3
  • 2
5 Comments
 
LVL 13

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 13

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 13

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

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…
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 …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

752 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