Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How to Load Form with VB.NET

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 02-03-2009
Member
 
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

Reply With Quote
  #2  
Old 02-03-2009
Member
 
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
Reply With Quote
  #3  
Old 02-03-2009
Member
 
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.
Reply With Quote
  #4  
Old 02-03-2009
Member
 
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,
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to Load Form with VB.NET"
Thread Thread Starter Forum Replies Last Post
Google Chrome is opening in basic HTML form instead of the Standard form Beatrix Technology & Internet 5 25-05-2011 11:21 PM
how to get items in a form to auto-resize with the form using visual basic deansmylie93 Software Development 2 02-05-2011 08:06 AM
How to load/install Java Card in the JAR form Namuchi Software Development 5 20-07-2010 03:56 AM
Procedure in VB to create form inside another form Jalabala Software Development 3 16-11-2009 02:14 PM
Problem reloading MDI child form in main form. AFFAN Software Development 3 30-01-2009 09:05 PM


All times are GMT +5.5. The time now is 12:00 AM.