Solved

Rotating through forms

Posted on 2007-11-22
6
245 Views
Last Modified: 2012-05-05
Hello

I've created a basic application that rotates through 10 different forms, after the application reach's the last form it should keep rotating until the main menu button is pressed. After one complete cycle it appears to stop rotating. Do I need to reset the timer or something?

Thanks
0
Comment
Question by:eagles396
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20336495
how do you rotate through forms?
0
 

Author Comment

by:eagles396
ID: 20336546
Add Timer control to each form.

Set enabled to True
Set interval to 5000




Add the following code to Form 1
 
Private Sub Timer1(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick
 
Form2.Show()
 
End Sub
 
Add the following code to Form 2
 
 
  Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
 
Form1.Close()
 
End Sub

Open in new window

0
 

Author Comment

by:eagles396
ID: 20336553
Sorry, code for form1 should read:

 
Private Sub Timer(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick
 
Form2.Show()
 
End Sub
 

Open in new window

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20336662
it is a strange code. Better you can switch between forms from the outside. That is, you can display forms inside a frame form, then you can put the timer on the frame form and switch indefinitely.
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 100 total points
ID: 20336942
Just close the current form immediately after you open the next one:

    Private Sub Timer(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick
        Timer1.Stop()
        Form2.Show()
        Me.Close()
    End Sub

To keep the app from closing:

    Click on Project --> Properties.
    Then on the Application Tab (selected by default)...
    Change the "Shutdown Mode" dropdown to "When last form closes"
0
 

Author Comment

by:eagles396
ID: 20345502
Thanks for your help.
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question