N00bish VB question - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Skype & Technology (/forumdisplay.php?fid=9) +---- Forum: Tech Talk (/forumdisplay.php?fid=17) +----- Thread: N00bish VB question (/showthread.php?tid=26710) N00bish VB question by Anubis on 06-04-2004 at 02:51 PM
I'm very new to Visual Basic and I'm making a program that displays text after text in a label when you click a button...but the only code I know is how to make a text in a label change once...like this; code:Could someone tell me the code to make the text change once again when the button's pressed again... RE: N00bish VB question by Stigmata on 06-04-2004 at 02:58 PM
my gay way code: RE: N00bish VB question by Anubis on 06-04-2004 at 03:01 PM
What about adding like 20 bits of text...which I need to do for this ap RE: N00bish VB question by Stigmata on 06-04-2004 at 03:03 PM
RE: N00bish VB question by Anubis on 06-04-2004 at 03:05 PM
quote:You sure that's there's no more direct method? RE: N00bish VB question by Choli on 06-04-2004 at 03:10 PM
declare a global variable (outside any function or sub you put the declaration) code:in the load sub of the form, make sure you initializa that variable to the proper number, 0 for example) code:and in the button click sub, you put this code: code: there are other ways to do that too. If the texts to be displayed are always the same, you can create an array of text and use the times variable to access the proper text (label1.caption=label1_texts[times]) RE: N00bish VB question by Sk3tch on 06-04-2004 at 03:10 PM
quote:Yes.. use the case method quote:Make sure all the control names are the same.. ect.. RE: N00bish VB question by Anubis on 06-04-2004 at 03:12 PM
quote:case method? What's that? RE: N00bish VB question by Choli on 06-04-2004 at 03:16 PM
quote:what I've just posted code: RE: N00bish VB question by Anubis on 06-04-2004 at 03:21 PM
It doesn't seem to be working...I had to change it slightly because my version of VB uses slightly different codes; code: RE: N00bish VB question by dotNorma on 06-04-2004 at 03:22 PM
quote: Private Sub Command1_Click() Times = Times + 1 *The user clicked the button once more Case 1 (1st time the button is clicked) Label1.Caption="First Text" Case 2 '(2nd time the button is clicked) Label1.Caption="Second Text" Case 3 (3rd time the button is clicked) Label1.Caption="Third Text" Case Else Label1.Caption="Here is where the text goes when all the other cases have been gone threw." End select End sub Its what Choli said. I cleaned it up a bit Edit :: You people beat me by a mile RE: N00bish VB question by Mike on 06-04-2004 at 03:44 PM
Does this help? RE: N00bish VB question by Choli on 06-04-2004 at 05:15 PM
quote:of course, you have to adjust it depending on the name of the button, label and form quote:of course, but doing "select case"s with strings is way slower than with a long RE: N00bish VB question by Millenium_edition on 06-04-2004 at 05:37 PM
ehm, why not use an array? code: |