Click to See Complete Forum and Search --> : variable not defined


Crusade Staff
March 22nd, 2001, 01:06 AM
I found some code, and it worked with what the example had, but once I put my graphics in, it gave me an error when compiling saying: Variable not Defined, and the variable in question is "Splash Timer" on line 35 in the Below code. Can someone help me, I don't know what to do at this stage?

Option Explicit

Private ReadyToUnload As Boolean
Private TimerExpired As Boolean

Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const HWND_TOPMOST = -1

' The minimum amount of time has expired and the
' program is ready to begin work.
Private Sub HideSplash()
' Reenable the main program.
Form1.Enabled = True

' Remove the splash screen.
Unload Me
End Sub

' The main program is ready to start work.
Public Sub ReadyToWork()
ReadyToUnload = True
If TimerExpired Then HideSplash
End Sub

Public Sub ShowSplash()
' The minimum amount of time the splash screen
' will be visible.
SplashTimer.Interval = 3000

' Center the form.
Left = (Screen.Width - Width) / 2
Top = (Screen.Height - Height) / 2

' Make this a topmost window.
SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, _
SWP_NOMOVE + SWP_NOSIZE

' Display the form.
Me.Show
End Sub
' The minimum time has expired.
Private Sub SplashTimer_Timer()
TimerExpired = True
SplashTimer.Enabled = False (< --This line here)
If ReadyToUnload Then HideSplash
End Sub

Thank you!

"Evil will always win because Good is dumb"

robby bassic
March 22nd, 2001, 01:40 AM
It looks perfectly fine, I even pasted it to a new project and compiled it.

Stupid question, is your Timer control named "SplashTimer" and spelled correctly? Also when you type SplashTimer and press period does the hint pop up?

Crusade Staff
March 22nd, 2001, 02:18 AM
*bangs head on desk again and again and again*

I think you know what I did wrong :)

"Evil will always win because Good is dumb"