Welcome to Dream.In.Code
Become a VB Expert!

Join 149,999 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,348 people online right now. Registration is fast and FREE... Join Now!




storing a variable

 
Reply to this topicStart new topic

storing a variable

lab3tech
19 Nov, 2006 - 06:05 AM
Post #1

New D.I.C Head
*

Joined: 28 Oct, 2006
Posts: 46


My Contributions
I am trying to capture the total number of times a button has been clicked. I have a loop set up to increment the count by 1, but each time the program is run the count goes back to 0.
CODE

Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim totclicks As Integer
        Dim n As Integer
        
        Do
            totclicks =n + 1
        Loop While n > 0

        Button1.Text = totclicks
    End Sub

I know the number of clicks is stored in mouseseventargs but do not know hoe to get that information into my program

Thanks in advance.

EDIT : Added Code Tags - b2c
User is offlineProfile CardPM
+Quote Post

lab3tech
RE: Storing A Variable
19 Nov, 2006 - 06:22 AM
Post #2

New D.I.C Head
*

Joined: 28 Oct, 2006
Posts: 46


My Contributions
QUOTE(lab3tech @ 19 Nov, 2006 - 07:05 AM) *

I am trying to capture the total number of times a button has been clicked. I have a loop set up to increment the count by 1, but each time the program is run the count goes back to 0.

Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim totclicks As Integer
Dim n As Integer

Do
totclicks =n + 1
Loop While n > 0

Button1.Text = totclicks
End Sub

I know the number of clicks is stored in mouseseventargs but do not know hoe to get that information into my program

Thanks in advance.



I GOT IT TO WORK!! Remembered functions, and wrote a function to store the result of the previous clicks - now works beautifully!!!
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 08:21PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month