Solved

SET SIZE OF FORM AT RUNTIME

Posted on 2012-03-17
4
223 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
Comment Utility
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
Comment Utility
Hi Idle_Mind,

  Me.StartPosition = FormStartPosition.Manual

What is it for ?

Thank you.
0
 
LVL 85

Expert Comment

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

Author Closing Comment

by:emi_sastra
Comment Utility
Ok.

Thank you very much for your help.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 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