Question i += 1 (dim i as integer)

iLogey

New member
Joined
Nov 30, 2013
Messages
1
Programming Experience
Beginner
I am extremely new to coding, and I've encountered many issues already. Normally, I could just search for it on Google and find out how to fix it and realize my mistakes or how to improve the code or even just learn something I didn't know before but I've been searching for this for about half an hour with no luck.

Right now I have a timer which adds 1 to a label every second:

VB.NET:
        i += 1
        Label5.Text = i.ToString

I want to know if there's a way to have a button, and every time I click the button, it would go up by one more. For example:
at the moment it's going up by 1 every second. I click a button and then it starts going up by 2 seconds, if I click it again, it starts going up by 3 seconds, etc.

Any help please?

Thanks in advance!

Edit: Nevermind! I didn't figure it out - but I found out a different way to accomplish my goal.
 
Last edited:
May I suggest that, in future, you add a new post to your thread rather than editing the existing one.

I'm not sure whether you'll need it or not but the solution to your original problem would to use a variable in your code to increment 'i' rather than the literal value 1. In the Click event handler of your Button you can then simply increment that variable. It would be initialised to 1 so 'i' would be initially incremented by 1 each time. If you then increment that variable to 2 then 'i' will be incremented by 2 each time.
 
Back
Top