Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Position form at the bottom right corner of the screen in visual basic

Tags:

vb.net

How can I position a form at the bottom right corner of the screen when the form loads? I'm using Visual Basic 2010 Express.

Thanks

EDIT: I did this and it seems to work great.

Dim x As Integer
Dim y As Integer
x = Screen.PrimaryScreen.WorkingArea.Width - 400
y = Screen.PrimaryScreen.WorkingArea.Height - 270
Me.Location = New Point(x, y)
like image 613
Utku Dalmaz Avatar asked Dec 04 '09 11:12

Utku Dalmaz


2 Answers

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Me.Visible = True
    Dim x As Integer
    Dim y As Integer
    x = Screen.PrimaryScreen.WorkingArea.Width
    y = Screen.PrimaryScreen.WorkingArea.Height - Me.Height

    Do Until x = Screen.PrimaryScreen.WorkingArea.Width - Me.Width
        x = x - 1
        Me.Location = New Point(x, y)
    Loop

End Sub
like image 140
Lost Avatar answered Nov 16 '22 01:11

Lost


You need to change the Form.StartPosition to Manual and change the Location property of the form

eg how to set form startup location/position manually?

or

VB.net - Form Start Position Upper Left

using Form.StartPosition Property and Form.Location Property

like image 25
Adriaan Stander Avatar answered Nov 16 '22 00:11

Adriaan Stander