943,719 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 1947
  • VB.NET RSS
Mar 31st, 2009
0

Starting a Program using VB Module

Expand Post »
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:

VB.NET Syntax (Toggle Plain Text)
  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....?
Similar Threads
Reputation Points: 11
Solved Threads: 0
Junior Poster in Training
jhonnyboy is offline Offline
97 posts
since Jul 2008
Mar 31st, 2009
0

Re: Starting a Program using VB Module

This doesn't exactly answer how to do it from the module, but shows how to create and dispose forms (from the "main" form)
VB.NET Syntax (Toggle Plain Text)
  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.
Reputation Points: 218
Solved Threads: 201
Veteran Poster
Teme64 is offline Offline
1,024 posts
since Aug 2008
Mar 31st, 2009
0

Re: Starting a Program using VB Module

This is just what i was looking for. Thanks!
Reputation Points: 11
Solved Threads: 0
Junior Poster in Training
jhonnyboy is offline Offline
97 posts
since Jul 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Multi Column List Boxes
Next Thread in VB.NET Forum Timeline: Adding Up TimeofDay to a file?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC