• VB.NET: Cycle? How should I do?
    9 replies, posted
Hello. I'm currently programming small programs in VB.NET. It's nothing serious, I just do it for the fun of it, so please don't blaze me with your flames. What I want to do for my next application is to make a cycle. I want a label to cycle through four words each second (one word each 250ms). I've tried using a timer with the interval of 250 ms and abusing the 'If' syntax, but that will logically enough result in a '360 degree turn', which results in the same word being displayed 24/7. An example of what I mentioned above written horribly: [code] If Label3.Text = "FFS" Then Label3.Text = "OMG" End If If Label3.Text = "OMG" Then Label3.Text = "WTF" End If If Label3.Text = "WTF" Then Label3.Text = "BBQ" End If If Label3.Text = "BBQ" Then Label3.Text = "FFS" End If [/code] Any help is appreciated. I'm not quite experienced with loops, but I have a feeling that I'm gonna have to learn it.
Use ElseIf. [code] If Label3.Text = "FFS" Then Label3.Text = "OMG" ElseIf Label3.Text = "OMG" Then Label3.Text = "WTF" ElseIf Label3.Text = "WTF" Then Label3.Text = "BBQ" ElseIf Label3.Text = "BBQ" Then Label3.Text = "FFS" End If [/code]
[QUOTE=jA_cOp;17467427]Use ElseIf. [code] Awesome code [/code][/QUOTE] Thanks, bro. Just what I needed. I never used ElseIf before, but I guess I will from now on.
You should learn C#. It's overall a better language and easier to use. Stuff like this would be easy.
Even better, use this: [url]http://www.homeandlearn.co.uk/NET/nets1p21.html[/url]
[QUOTE=Loli;17467760]You should learn C#. It's overall a better language and easier to use. Stuff like this would be easy.[/QUOTE] How is it better? I mean, it's more or less the same syntaxes as far as I've noticed. I never really understood what the main differences is.
[QUOTE=Within;17504456]How is it better? I mean, it's more or less the same syntaxes as far as I've noticed. I never really understood what the main differences is.[/QUOTE] :what:
[QUOTE=Ortzinator;17504554]:what:[/QUOTE] I just asked a question.
[QUOTE=Within;17505315]I just asked a question.[/QUOTE] [img]http://dl.getdropbox.com/u/99606/uh_what.png[/img] Either you haven't researched the languages in question, or you think the "Console.WriteLine()" constitutes the entire syntax. They share the .NET framework, but their syntax's are nowhere near similar.
That answers my question, thank you.
Sorry, you need to Log In to post a reply to this thread.