need halp - workin with Timer show hide object

midan1

Member
Joined
Dec 10, 2006
Messages
9
Programming Experience
Beginner
i need to createa Windows Form
with timer that show hide "object" evry 10 minute
a flash shockwave flash
swf file
"Me.AxShockwaveFlash1.Visible = True"
how to do it
i need example
i am new in Windows Form
TNX
 

lingsn

Well-known member
Joined
Nov 16, 2006
Messages
287
Programming Experience
Beginner
Get the Timer from the Toolbox and put it to the form. Set the Timer's property, interval to 10 minutes. The interval was count in milisecond, so you have to put 10 * 60 * 1000 = 600000 in the Timer's interval.

Double click on the Timer, and it will go to the code, and show the Timer's event. Put the code into the Timer's tick event:

Code:
[SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Timer1_Tick([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] Timer1.Tick[/SIZE]
[SIZE=2]Me.AxShockwaveFlash1.Visible = NOT Me.AxShockwaveFlash1.Visible
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub
[/COLOR][/SIZE]
 

midan1

Member
Joined
Dec 10, 2006
Messages
9
Programming Experience
Beginner
TNX
but how i can play the flash file for only 1 minute every 10 minute ???
 

lingsn

Well-known member
Joined
Nov 16, 2006
Messages
287
Programming Experience
Beginner
I think is something like this

Code:
[SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Timer1_Tick([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] Timer1.Tick[/SIZE]
Timer1.Stop()
IF Me.AxShockwaveFlash1.Visible Then
   Timer1.interval = 540000
ELSE
   Timer1.interval = 60000
END IF
[SIZE=2]Me.AxShockwaveFlash1.Visible = NOT Me.AxShockwaveFlash1.Visible[/SIZE]
[SIZE=2]Timer1.Start()
[/SIZE][SIZE=2][COLOR=#0000ff]End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
 

midan1

Member
Joined
Dec 10, 2006
Messages
9
Programming Experience
Beginner
no it not workig can you halp ??

lingsn,no it not workig can you halp ??
TNX
 

midan1

Member
Joined
Dec 10, 2006
Messages
9
Programming Experience
Beginner
not working !!
PrivateSub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer1.Stop()
IF Me.AxShockwaveFlash1.Visible Then
Timer1.interval = 540000
ELSE
Timer1.interval = 60000
END IF
Me.AxShockwaveFlash1.Visible = NOT Me.AxShockwaveFlash1.Visible
Timer1.Start()
End Sub
 

CygNuS

Well-known member
Joined
Aug 21, 2006
Messages
89
Location
Belgium
Programming Experience
Beginner
It looks ok to me ?

Did you set Me.AxShockwaveFlash1.Visible = True and Timer1.interval = 60000 when your form loads (before timer starts)
Then start the timer.

If i understand lingsn's code correctly, the flash movie should be visible for 1 minute... then stop, then after 9 minutes it's visible again for 1 minute etc.
 
Top Bottom