Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Creating an incramental counter

Posted on 1999-01-19
4
Medium Priority
?
165 Views
Last Modified: 2010-05-03
I need to create a counter that will count in incraments of 1 every time I click a command button, and display the number on a label on the same form.  Any suggestions would be mucho appreciated.
0
Comment
Question by:agenda
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
mark2150 earned 150 total points
ID: 1469439
put this in Form_Load

Command1.tag = 0

PRIVATE Command1_Click()
count = val(command1.tag)
count = count + 1
command1.tag = count
label1.caption = count
END SUB


0
 

Author Comment

by:agenda
ID: 1469440
This did not work, it say's cannot assign to a read only property.  I tried it in the form_load and the command button.  but it has not worked
0
 
LVL 12

Expert Comment

by:mark2150
ID: 1469441
Oops! COUNT is a reserved word. Change it to CNT and it'll work.

M

0
 
LVL 1

Expert Comment

by:Johnn
ID: 1469442
Email me if you want a cool odometer control

jnickle@shaw.wave.ca
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

916 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