Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > BOOK: Visual Basic 2005 Programmer's Reference
|
BOOK: Visual Basic 2005 Programmer's Reference
This is the forum to discuss the Wrox book Visual Basic 2005 Programmer's Reference by Rod Stephens; ISBN: 9780764571985
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Visual Basic 2005 Programmer's Reference section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 15th, 2006, 10:19 AM
Authorized User
 
Join Date: Dec 2006
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to dynamically choose the startup form?

My app sometimes needs to show a form before the main form. I've tried putting code in the main form's new() procedure and its Load event handler to hide it while the other form is shown - but the main form is shown anyway (even if its "visible" property is set false in the designer).

I'd normally do this in a sub Main, but VB.net seems only to allow startup forms.

What's the best way round this?


 
Old December 15th, 2006, 01:44 PM
Authorized User
 
Join Date: Dec 2006
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've found a way by setting Me.WindowState = FormWindowState.Minimized in the load event handler of the main form and Me.WindowState = FormWindowState.normal before the optional form closes.

This is not perfect as there is still a taksbar entry for the main form that the user can click, and I can't seem to suspend it while the optional form is showing.

 
Old December 16th, 2006, 10:18 AM
Rod Stephens's Avatar
Wrox Author
 
Join Date: Jan 2006
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

It sounds like the user must interact with the other form before moving on to the main form. In that case, the main form's Load event handler can display the other form modally. Then the main form will not become visible until the user has closed the otehr form.

    Dim frm As New OtherForm
    frm.ShowDialog()


Rod
RodStephens@vb-helper.com
Author of "Visual Basic 2005 Programmer's Reference"
http://www.vb-helper.com/vb_prog_ref.htm

Sign up for the free VB Helper Newsletters at http://www.vb-helper.com/newsletter.html





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set a form as startup form in vb.net 2.0 mallikalapati .NET Framework 2.0 1 February 21st, 2008 09:19 AM
dynamically generated form SaraJaneQ Javascript How-To 4 November 9th, 2006 11:11 AM
How to get rid of everything except startup form. biglazy Access 9 March 23rd, 2006 07:33 PM
Form Startup Order NeilS21 Beginning VB 6 2 February 26th, 2004 05:44 AM
Global instantiation of startup form hilda007 VB.NET 2002/2003 Basics 5 February 21st, 2004 01:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.