[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

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?
0
Moin
Asked:
Moin
1 Solution
 
deightonCommented:
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now