Solved

SET SIZE OF FORM AT RUNTIME

Posted on 2012-03-17
4
230 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
[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
  • 2
  • 2
4 Comments
 
LVL 86

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 86

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

751 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