Starting a Program using VB Module

Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jul 2008
Posts: 86
Reputation: jhonnyboy is an unknown quantity at this point 
Solved Threads: 0
jhonnyboy jhonnyboy is offline Offline
Junior Poster in Training

Starting a Program using VB Module

 
0
  #1
Mar 31st, 2009
Hello everyone, I have a program that i am working on using more than one Form. The way i am going through forms is by minimizing my first form then showing the other forms. I was wondering if i start the program from a module maybe i can unload forms making my program much more effective. Here is some of my current code:

  1. emainForm.Show()
  2. Me.WindowState = FormWindowState.Minimized
  3. Me.Hide()

I would love to unload the current form and show emainForm. Right now i have an empty module, i would imagine i would have to make a private sub, but i wouldn't know the syntax from there. I'm guessing welcomeForm.load then unload....?
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 710
Reputation: Teme64 will become famous soon enough Teme64 will become famous soon enough 
Solved Threads: 114
Teme64's Avatar
Teme64 Teme64 is offline Offline
Master Poster

Re: Starting a Program using VB Module

 
0
  #2
Mar 31st, 2009
This doesn't exactly answer how to do it from the module, but shows how to create and dispose forms (from the "main" form)
  1. ' A global variable to "hold" the form
  2. Private aForm As Form
  3.  
  4. Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
  5. '
  6. ' Create a new instance from the Form2 class
  7. aForm = New Form2
  8. ' Show the form instance
  9. aForm.Show()
  10.  
  11. End Sub
  12.  
  13. Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
  14. '
  15. ' Close the form
  16. aForm.Close()
  17. ' And dispose it
  18. aForm = Nothing
  19.  
  20. End Sub
I didn't check it, but you should be able to create and dispose forms from a module with the above code.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 86
Reputation: jhonnyboy is an unknown quantity at this point 
Solved Threads: 0
jhonnyboy jhonnyboy is offline Offline
Junior Poster in Training

Re: Starting a Program using VB Module

 
0
  #3
Mar 31st, 2009
This is just what i was looking for. Thanks!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC