Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

[VB.NET] Use label to count [Add up how many times you've done something]

This will show you how to use a simple label that will count how
many times you do something, such as send a SMS, Or send an E-mail
Or whatever your program is meant to do.

First thing you do is set up how you want your program to work
and add a label and change the text from label1 to the number "0"
I suggest you add another text label in front of that one that
says "Total Times Sent:" Or whatever you would like so it comes
out 2.
Total Times Sent: 0
[IMG]http://i31.[censored].com/343svoi.jpg[/IMG]

Then add this code by its self (Not in another objects directory to place code)
Which ever label# you want to change is the one you need to add. Ex: Label2, Label3, Label4, etc.
Code
Private Counter As Integer = 0
And use this code to add into another sub.
Code
Private Sub SetLabel()
        Me.Label1.Text = Counter.ToString()
    End Sub

[IMG]http://i25.[censored].com/33jn3w3.jpg[/IMG]


Now I'm going to use a timer for this section
This is best used with timers and minute timers.

Declare what you want your timer to do.
Such as send a SMS, or an E-mail
Or whatever you want it to do then add this code.
Code
Counter += 1
        Me.SetLabel()

[IMG]http://i31.[censored].com/a59jc7.jpg[/IMG]

Now you can save, build, And test your program to make sure
you have done everything right and it works fine so far.

[IMG]http://i32.[censored].com/14xdm9x.jpg[/IMG]


Possibly Related Threads...
Thread / Author Replies Views Last Post
by joepaullySep 2, 2024 10:05 PM 0 123 Sep 2, 2024 10:05 PM
Last Post: joepaully
by Alma JulietaJan 26, 2023 09:20 PM 0 112 Jan 26, 2023 09:20 PM
Last Post: Alma Julieta
[.NET] by StoneMay 19, 2020 01:15 AM 1 136 May 19, 2020 01:15 AM
Last Post: SIM-3991524