By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,267 Members | 1,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,267 IT Pros & Developers. It's quick & easy.

Maximize form on Display2

P: n/a
Does anyone know a simple way to have a program start with the main
form maximized on Display2?
May 25 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On May 25, 11:28 am, Kevin <kevinp@nospam_cfl.rr.comwrote:
Does anyone know a simple way to have a program start with the main
form maximized on Display2?
Assuming Display2 shows up as Screen.AllScreens(1) add this to a
module:

Public Sub Main()
Application.EnableVisualStyles()

Dim f As New MainForm()

f.StartPosition = FormStartPosition.Manual

' You'll want to do some checking/error handling here to
' prevent an IndexOutOfRangeException from occuring

f.Top = Screen.AllScreens(1).WorkingArea.Y
f.Left = Screen.AllScreens(1).WorkingArea.X

f.WindowState = FormWindowState.Maximized

f.ShowDialog()
End Sub

Doing this requires you turn off the ApplicationFramework and select
Sub Main as the starting point.

Thanks,

Seth Rowe

May 25 '07 #2

P: n/a
Thanks for the reply, but actually I found Screen.AllScreens() just
after posting the question (Guess I should've looked a little harder,
eh?). Then I did a For...Each loop to get the working area of each
screen.

Works great. Thanks again.
On 25 May 2007 10:18:18 -0700, rowe_newsgroups <ro********@yahoo.com>
wrote:
>On May 25, 11:28 am, Kevin <kevinp@nospam_cfl.rr.comwrote:
>Does anyone know a simple way to have a program start with the main
form maximized on Display2?

Assuming Display2 shows up as Screen.AllScreens(1) add this to a
module:

Public Sub Main()
Application.EnableVisualStyles()

Dim f As New MainForm()

f.StartPosition = FormStartPosition.Manual

' You'll want to do some checking/error handling here to
' prevent an IndexOutOfRangeException from occuring

f.Top = Screen.AllScreens(1).WorkingArea.Y
f.Left = Screen.AllScreens(1).WorkingArea.X

f.WindowState = FormWindowState.Maximized

f.ShowDialog()
End Sub

Doing this requires you turn off the ApplicationFramework and select
Sub Main as the starting point.

Thanks,

Seth Rowe
May 25 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.