How to declare STATIC variable in VB5?

I am basically a C++ programmer. I want to declare a static variable in VB. How can I do this?
I know there is a static keyword but how can I initialize a variable that is declared as Static?
MoinAsked:
Who is Participating?
 
deightonConnect With a Mentor progCommented:
Slightly clumsy but worked for me

Private Sub Timer1_Timer()
    Static x As Integer
    Static bVar as boolean
    if not bVar then
       x = 100
       bVar = true
    end if
   
    etc.....

End Sub
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.