home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 1839
Discussions: 188,398, Posts: 2,243,595, Members: 232,629
Old December 4th, 2004, 04:35 PM   Digg it!   #1 (permalink)
Member
 
Join Date: Oct 2003
Posts: 255
Forms in VB

Hi,
(VB.NET)

Creo I asked this before but I am having a heck of a time trying to do this. I have an application where it loads form1. I am trying to intially hide form1 and show form2. However no matter where i put the form1.hide() or the form 1.visible=false it still shows form1.

I guess if someone can list when a page loads what subs does it launch? init?, then load? the finalize etc.

Where would I have to put the hide(). I even tried to put it in the form2_load and it still shows form1.

Any ideas guys???

Thank you

amtrac24 is offline   Reply With Quote
Old December 4th, 2004, 04:38 PM     #2 (permalink)
Kawaru wa yo!
 
Whir's Avatar
 
Join Date: Oct 2001
Location: Kingsford, MI
Posts: 16,137
Blog Entries: 7
Why not just make form1 form2 and vice versa? Does the current form1 NEED to load first for some reason?

Whir is online now   Reply With Quote
Old December 4th, 2004, 04:56 PM     #3 (permalink)
Member
 
Join Date: Oct 2003
Posts: 255
yeah form1 is gonna be my main menu and im gonna keep it loaded at all times. form 2 will be my splash screen. Form 1 needs to be atleast in memory at all times otherwise the application will close. If i use a sub main it loads the 2 forms and shows form 1 then exits the application.

amtrac24 is offline   Reply With Quote
Old December 4th, 2004, 05:00 PM     #4 (permalink)
Perfetc Member
 
VHockey86's Avatar
 
Join Date: Jan 2003
Location: Maryland Suburbia
Posts: 4,327
why not do Application.Run() or Application.Run(splashscreenform) - which will start and then load that form to begin with.

That'll keep the program thread open with or without a form open
Then you can show/hide accordingly.
VHockey86 is offline   Reply With Quote
Old December 4th, 2004, 05:32 PM     #5 (permalink)
Member
 
Join Date: Oct 2003
Posts: 255
alright i've never used application.run() would i need to create another .exe with just the splash creen. It would be alot bettter to keep 1 .exe with multiple forms
amtrac24 is offline   Reply With Quote
Old December 5th, 2004, 11:54 AM     #6 (permalink)
Member
 
Join Date: Oct 2003
Posts: 255
if anyone wants to know.... put it in the activated sub

Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
Dim f As New Form2

f.Show()
Me.Hide()
End Sub
amtrac24 is offline   Reply With Quote
Old December 5th, 2004, 05:51 PM     #7 (permalink)
Member
 
Join Date: Oct 2003
Posts: 255
Errrrrrrrrrrrr

I really hate how Microsoft used Forms in .net

ok I have the main form...it gets hidden as soon as the program loads under the activated property. Then the splash form loads with a timer and progress bar...after the progress bar =100 then i say close the splash screen and load the main menu screen. However it creates an endless loop. I believe it is because i have the code in main menu form to load the splash screen, so when i go from splash to .show the main menu it loads the main menu form again which has the code to reopen thesplash screen. I tested it and it doesnt seem like thats the case. here is my code. Any help would be great...thanks guys.
----------------------------------------------------------------------------------------------
Main Form Code

Private Sub frmMain_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
Dim Splash As New frmSplash()

Splash.Show()
Me.Hide()

End Sub
----------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------
Splash Code

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

Do While ProgressBar1.Value <> 100
ProgressBar1.Value = ProgressBar1.Value + 1

Loop

Timer1.Enabled = False

Dim Main As New frmMain()

Main.show

End Sub

Any Idea's
amtrac24 is offline   Reply With Quote
Old December 5th, 2004, 05:55 PM     #8 (permalink)
Perfetc Member
 
VHockey86's Avatar
 
Join Date: Jan 2003
Location: Maryland Suburbia
Posts: 4,327
I would avoid using stuff like "<>"
Try just a straight "<"
It could be that its ticking to 101 before the timer actually get disabled.

I'm not really sure how VB handles threads.... and if its half as bad as Java Threads you dont want to rely on really specific timing for operations/loops.
VHockey86 is offline   Reply With Quote
Old December 5th, 2004, 06:31 PM     #9 (permalink)
Member
 
Join Date: Oct 2003
Posts: 255
na thats not the problem. I just tried it and it still did the same thing. Any other guesses?
amtrac24 is offline   Reply With Quote
Old December 5th, 2004, 06:39 PM     #10 (permalink)
Perfetc Member
 
VHockey86's Avatar
 
Join Date: Jan 2003
Location: Maryland Suburbia
Posts: 4,327
Hmm, well if you changed it into a For/Next loop theres no way it would end up in an infinite loop, so you'd at least know if its a problem in that or not (which it prolly isnt though).

I'm really not al lthat familiar with .net languages and how it handles classes/objects, but why are you instantiating a new "main form" object.
Doesnt this object already exist?
In which case you should only need to pass reference to it.
VHockey86 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook VBS Programming w/ Forms nsohenick Applications and Operating Systems 2 July 17th, 2003 10:21 AM
Digital Research CD-RW rebate forms(Bestbuy.com)?? onlyvinay General Discussion and Buyer Guidance 3 July 12th, 2003 05:31 AM
E-Bay / PayPal Scam e-mail Not 2 Techie General Discussion and Buyer Guidance 4 March 8th, 2003 10:54 PM
Combo Boxes (Urgent Help required) shahzadsk Webmastering and Programming 7 August 5th, 2002 12:34 AM

Most Active Discussions
Is It Just Me? (2905)
Unarmed man on his stomach shot by .. (6)
Misery Loves Company... (2144)
New Build ( Finally ) (6)
CPU wont boot (7)
Building a gaming computer advice (5)
I think I just killed my computer w.. (24)
Folderchat Weekday thread (444)
Upgrading RAM (6)
Recent Discussions
Partition Magic 7.0 (Unallocate.. (17)
For cheap price and good qualit.. (1)
Left 4 Dead Small Freezes (3)
RCA 52Inch HDTV wont turn on (4)
wishin i could edit my aol prof.. (0)
Sporadic internet connectivity (2)
Assassins Creed PC Problems (40)
I think my PSU is dieing (1)
building a gaming computer, inp.. (0)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 03:32 AM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28