Solved

How to declare STATIC variable in VB5?

Posted on 1998-04-29
1
224 Views
Last Modified: 2011-10-03
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
Comment
Question by:Moin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 18

Accepted Solution

by:
deighton earned 20 total points
ID: 1434964
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Adding to a VBA? 6 90
Excel - Save a copy of work book 13 96
Send outlook email from VBS Script 2 67
Get the Y value of a line at X in a chart in VBA 28 73
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question