AdvancedHMI Software
General Category => Open Discussion => Topic started by: jsu0234m on August 10, 2018, 06:11:45 AM
-
I'm working on a project that has two screens and i want them to swap back and forth between each other after a certain amount of time. I have the two screens working and can swap back and forth as needed with form change buttons but i would like to add a button to enable the screens to swap back and forth on there own after a certain time has passed.
Process:
Main screen opens when project opens, press a button to enable screen swapping, wait 45 seconds and then swap to the 2nd screen, wait 45 seconds and swap back to the first screen. Repeat until screen swapping is turned off.
I have a timer on the screen and set to 45 seconds but i can't figure out how to actually call the screen change when the timer is done.
Any help would be appreciated, i've googled my heart out and i don't think i know enough about visual studio to search for the right help because i have found about everything else besides calling a form change button.
-
If you mean forms, then add timers & buttons to each form, and add something like below to each click & tick event to both forms:
Me.Hide()
Timer1.Stop()
Form2.Timer2.Start()
Form2.Show()
above example is for form1. swap the number for form2
-
You can also do it with one form, one timer, two panels, panel size will be close to the form size. on each panel will have one button:
Form_Load
For Each ctrl As Control In Controls
If ctrl.GetType Is GetType(Panel) Then
Panel2.Visible = False
Panel1.Visible = True
End If
Next
Button1_Click:
Timer1.Stop()
Timer1.Start()
Panel2.Visible = True
Panel1.Visible = False
Button2_Click:
Timer1.Stop()
Timer1.Start()
Panel2.Visible = False
Panel1.Visible = True
Timer Tick:
Private formflag As Boolean = False
If formflag Then
Panel2.Visible = False
Panel1.Visible = True
Else
Panel2.Visible = True
Panel1.Visible = False
End If
formflag = Not formflag
-
Thanks for your help. I got caught up in another project and am just now getting back to this. I'll try these and see what i can figure out.