Solved

SET SIZE OF FORM AT RUNTIME

Posted on 2012-03-17
4
225 Views
Last Modified: 2012-06-27
Hi All,

I have below code :

  Me.Left = 0
        Me.Top = 5

        Me.Width = Screen.PrimaryScreen.Bounds.Width - 10
        Me.Height = Screen.PrimaryScreen.Bounds.Height - 90

At what event should I put it and why ?

Thank you.
0
Comment
Question by:emi_sastra
  • 2
  • 2
4 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 37734034
You can put it in the Load() event of the form, but should probably also set the StartPosition() to Manual:
Public Class Form1

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Me.StartPosition = FormStartPosition.Manual
        Me.Left = 0
        Me.Top = 5

        Me.Width = Screen.PrimaryScreen.Bounds.Width - 10
        Me.Height = Screen.PrimaryScreen.Bounds.Height - 90
    End Sub

End Class

Open in new window

0
 
LVL 1

Author Comment

by:emi_sastra
ID: 37734090
Hi Idle_Mind,

  Me.StartPosition = FormStartPosition.Manual

What is it for ?

Thank you.
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 37734091
That keeps the form from being positioned automatically by the operating system itself.
0
 
LVL 1

Author Closing Comment

by:emi_sastra
ID: 37734101
Ok.

Thank you very much for your help.
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
Showdialog 8 29
Get list of word ducuments in a folder 10 35
POWERSHELL: do / until, should continue even when there is an error 4 51
Exit the loop 4 34
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

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

17 Experts available now in Live!

Get 1:1 Help Now