Results 1 to 4 of 4

Thread: How to Load Form with VB.NET

  1. #1
    Join Date
    Feb 2009
    Posts
    105

    How to Load Form with VB.NET

    Hi

    Is it possible to load a few forms without showing them? Also let me know the correct code for loading and unloading the Form, and Will it make showing of forms any faster when needed?

    Thanks

    Regards

  2. #2
    Join Date
    Nov 2008
    Posts
    58

    Re: How to Load Form with VB.NET

    (form) FrmMain

    The proper way to do this in VB.NET:

    Dim frm as New FrmMain
    Frm.Show

  3. #3
    Join Date
    Oct 2008
    Posts
    167

    Re: How to Load Form with VB.NET

    An important event you'll want to write code for is the Form Load event. You might want to, for example, set the Enabled property of a control to False when a form loads. Or maybe blank out an item on your menu. You can do all this from the Form Load event.

    Add another button to your form for this example, and we'll see how the Form Load event works. (If you haven't been following along, create a new project and add two buttons to it.

    Bring up your coding window, and select the Form1 Events from the drop down box.
    In the events drop down box, select Load. A code stub for the Form Load event is then added to your code. Type in the following as the code for the Load Event:

    MsgBox("Form Load Event")

    Run your program. You should see the message box display before the Form loads.

    To switch off your second Button before the Form loads, add this to your code:

    Button2.Enabled = False

    Run your programme again. You should see that button is no longer available for clicking on.

  4. #4
    Join Date
    Mar 2008
    Posts
    258

    Re: How to Load Form with VB.NET

    This loads the Form but doesn't show it.

    Dim F As New Form1
    It only calls the contructor (Sub New).

    Then this shows it (as you know)
    F.Show
    It calls Form_Load (first time in) and Show.

    If a Form takes a lot of time to set up then you can make it quicker in appearing by preloading. But the point at which you do your preloading will then suffer the delay! If you can arrange the loading to happen while the User is fiddling about with the UI and there are some spare CPU cycles, then a gain can be made.

    I'd recommend doing some timing tests before going to a lot of trouble.

    Regards,

Similar Threads

  1. Replies: 5
    Last Post: 25-05-2011, 10:21 PM
  2. Replies: 2
    Last Post: 02-05-2011, 07:06 AM
  3. How to load/install Java Card in the JAR form
    By Namuchi in forum Software Development
    Replies: 5
    Last Post: 20-07-2010, 02:56 AM
  4. Procedure in VB to create form inside another form
    By Jalabala in forum Software Development
    Replies: 3
    Last Post: 16-11-2009, 02:14 PM
  5. Problem reloading MDI child form in main form.
    By AFFAN in forum Software Development
    Replies: 3
    Last Post: 30-01-2009, 09:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,890,065.21739 seconds with 17 queries