CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1

    variable not defined

    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"

  2. #2

    Re: variable not defined

    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?


  3. #3

    Re: variable not defined

    *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"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured