VB.NET Help? - Printable Version +- Support Forums (https://www.supportforums.net) +-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87) +--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18) +---- Forum: Visual Basic and the .NET Framework (https://www.supportforums.net/forumdisplay.php?fid=19) +---- Thread: VB.NET Help? (/showthread.php?tid=24589) |
VB.NET Help? - BreShiE - 01-15-2012 Hey, I'm trying to make a program which picks one text string each time you click a button. I have a bunch of text strings and I was just wondering how I could make it pick a different one each time I click the button. This doesn't work, but is what I tried: Code: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click RE: VB.NET Help? - AceInfinity - 01-15-2012 lol the debugger doesn't have a mind of it's own, you can't give it choices based on no logical calculation. Code: Public KeyA() As String = {"item 1", "item 2", "item 3", "item 4", "item 5"} that's what I would do. My function ReturnKey takes 2 parameters, first parameter specifies the input string array, which i've created above called KeyA(), and the second parameter is used to identify the last index of that array so that our random calculation doesn't try to specify or return an index out of the array. RE: VB.NET Help? - BreShiE - 01-15-2012 Works perfectly Ace, thanks a lot mate. RE: VB.NET Help? - AceInfinity - 01-15-2012 No problem, it's a function I previously posted on the forum, so I know it works, I created and debugged it myself before I posted to help another member out here. RE: VB.NET Help? - BreShiE - 01-15-2012 (01-15-2012, 06:01 AM)AceInfinity Wrote: No problem, it's a function I previously posted on the forum, so I know it works, I created and debugged it myself before I posted to help another member out here. Ah, I just needed it for my next release. I'll post it on TLF when it's done. I can't post it here because I guess it can be classed as illegals. RE: VB.NET Help? - AceInfinity - 01-15-2012 (01-15-2012, 08:12 AM)BreShiE Wrote: Ah, I just needed it for my next release. I'll post it on TLF when it's done. I can't post it here because I guess it can be classed as illegals. TLF's rules isn't any different if you read them. |