Loading a new form!

Forum,

I am using the Visual Basic Express Beta version. I've been trying it out and have noticed some language enhancements. Ive used Visual Basic 6.0 and have the code to load a new forum.

In other words, I want the user to be able to click a button and it will load a new window. While closing the Previous form, using the Unload Me function.

I want the code for VB Express Edition Beta, to load a new window. Any ideas Code samplings would be great. Thanks for your help!

Ben.




Answer this question

Loading a new form!

  • Sumit2006

    erm... thanks, I didn't know that, but I didn't say to make the main form invisible. I said to make the main form contain more than one form, in the form of user controls. The form stays visible, the user controls do not, as each defines a different form.



  • SherryZ.

    ivolved_Mike_Brown wrote:

    Actually, if you change your main form's visibility to false, your application will shut down as well.

    Not on my system it doesn't.

    cgraus wrote:

    Your main form defines the lifetime of the application, you can't close it without closing hte program.

    By default this is true but there is an option in Project Properties to change the shutdown mode so that the program only quits when the last form is closed.

    Dave


  • D13G0

    cgraus wrote:

    erm... thanks, I didn't know that, but I didn't say to make the main form invisible. I said to make the main form contain more than one form, in the form of user controls. The form stays visible, the user controls do not, as each defines a different form.

    Ahhhhhhh...I get what you're saying. You were recommending swapping out controls in a deck-like format. I think it's a bit advanced technique in this instance.

    To the original poster: I'd recommend registering your copy of VB express and downloading the free e-book that comes with your registration. The book will teach you everything you need to know as a beginner.



  • Miguel Angelo

    Hi Ben,

    Does any of the replies answer your post If yes, then could you please mark it as Answer.

    Thanks,
    Bhanu.



  • CaiCheng

    Any new form will be a variable of the main form. So, you create the form in the designer/IDE, create an instance of the form, and then call ShowDialog to show the form modally ( so it takes the focus ), or Show to show the form as a popup window ( which means you should make it a member variable ).

    Your main form defines the lifetime of the application, you can't close it without closing hte program. If you want to move between windows, your best bet is to create them as user controls and change the visible control on your main form.



  • camus

    cgraus wrote:

    Any new form will be a variable of the main form. So, you create the form in the designer/IDE, create an instance of the form, and then call ShowDialog to show the form modally ( so it takes the focus ), or Show to show the form as a popup window ( which means you should make it a member variable ).

    Your main form defines the lifetime of the application, you can't close it without closing hte program. If you want to move between windows, your best bet is to create them as user controls and change the visible control on your main form.

    Actually, if you change your main form's visibility to false, your application will shut down as well.

    What you want to do is use a main function, declare a static shutdown variable, and have the main function handle displaying and hiding forms.



  • Loading a new form!