Click here to Skip to main content
15,900,907 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

i am making a form in visual basic 2008 which uses a timer and progress bar to load another form.

in the timer i have the following code:
VB
Loading.Increment(1)
If Loading.Value = Loading.Maximum Then
   AboutBox.Show()
End If

so the AboutBox shows up after the progress bar has reached maximum. but i want it close the form where this progress bar is.

if i use Me.Close() then it closes the whole programme. how can i close the form without stopping the whole programme? it also keeps the AboutBox open forever even if you close the programme is there a way of keeping a form open for a certain time?

and is there a way of starting the timer automatically when the programme starts without using a button?

thanks
amir
Posted
Updated 7-Jul-10 10:35am
v2
Comments
Sandeep Mewara 7-Jul-10 16:36pm    
Use PRE tags to format code part from next time. Question looks more readable after that.

To see why Me.Close closes the whole program, you need to look at the properties of your project. Go to the Application Tab and you'll see a box that says "Windows application framework properties". The Shutdown mode is automatically set to "When startup form closes". So, when the first form closes, so will the application. You can change that to "When last form closes" and you won't have that problem.

As far as closing the About box, just add a timer to the about box and close it when the timer reaches it's time.

And, yes, of course there's a way to start the timer automatically. It's called the form's Load event. If you double-click on a newly created form, it will take you to the Load event. Place the code there to start the timer and it will start when the form loads.
 
Share this answer
 
Start the timer at pageLoad()
sub Form1_Load()
   Timer1.Interval = 1000 
   Timer1.Start
end sub


Hide the FirstForm and then show the when timer reaches the maximum value

If Timer1.Value = Timer1.Maximum Then
  Me.Hide()
  form2.Show()
End If


regards
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900