Ok, I don't have any screen shots ATM, so bear with my code-only tut.
This tutorial is for those of you with a little Visual Basic experience but are still beginners.
First off say you wanted to make your form print out a number 5 times, 1, 2, 3, 4, and 5. You think "HEY, MICROSOFT IS COOL THEY PROBABLY MADE SOMETHING WITH THE TIMER TO SET THE AMOUNT OF TIME'S IT GOES OFF!!! YEA AREN'T I SMART!!" Well, no. Sorry, but they didn't. Here's how you would do it though.
First you make a form with a single button on it, and a timer. For the button make the code...
Ok now that you have that when you hit the button the timer starts. Now above the button code you need to put the declarations, or declaration in this case.Code:mitymer.enabled = True
Now that you have the declaration, you can start the timer coding. Double click on the timer so you get to the code view and add this...Code:Dim thisoddnumber As Integer = 0
You can make the numbers anything, it doesn't really matter but you also have to change all of them accordingly. I should have the screen shots up later tonight or tomorrow. Thanks for reading, and alert me of any bugsCode:thisoddnumber = thisoddnumber + 1 If thisoddnumber = 5 then mitymer.enabled = False![]()
Last edited by Logan; 08-09-2009 at 08:09 PM.
Nice. Isn't amazing how often a "feature" isn't really needed?
I can't edit it so I guess I'll post it down here... For the timer code, instead of
it should beCode:thisoddnumber = thisoddnumber + 1 If thisoddnumber > 5 then mitymer.enabled = False
Code:thisoddnumber = thisoddnumber + 1 Print thisoddnumber If thisoddnumber = 5 then mitymer.enabled = False
Nice little tutorial, +rep!![]()
nice one .. +rep![]()
I have never got the Print funtion to work in .NET. I believe it is a feature of VB6 only.
Also, I look at this code:
This should be written like this:Code:thisoddnumber = thisoddnumber + 1
Also, you have this:Code:thisoddnumber += 1
This code is inefficient and and If conditional statement is unnecessary. Consider this:Code:If thisoddnumber = 5 then mitymer.enabled = False
Code:mitymer.Enabled = Not (thisoddnumber = 5)
Nice One .. +rep .
No Xav, I like my inefficient code. It's pretty, and nice for the n00bs.
very nice tiutorial
+rep when i can
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
www.amrosama.com | the unholy methods of javascriptCode:eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks