0

Hello all!
Firstly, sorry, it's been a while since I've been programming and I'm relatively new to VB

My question is this;
I want to change the number in an object identifier to what ever number the program picks at random.
Roulette, 37 spots on the wheel, random number 1-37, and there are 37 images which can be displayed in accordance to that.
Now, to save myself from writing out 37 If commands, I'd like to know if there is a way to get around that.
the object identifiers are W1, W2, W3, W4.......W37


[
Dim digx As Integer = 2
Dim NUM As Integer
Dim WPos As String

Randomize()
NUM = Int(((4 + 1) - 1) * Rnd() + 1)

Me.DNUM.Text = NUM
Me.PWheel.BringToFront()

WPos = "W" & NUM
Me.TB.Text = WPos
]

(only doing 1-4 to keep it simple for now)

everything works there great so far. I can get the output i want being "w"x. But when trying to reference that string value to an object, ie [ me.WPos.BringToFront () ] it doesn't like that.

Any way to fix that?

Edited by johnovision27: n/a

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by johnovision27
0

Are you sure you are using Visual Basic 6.0? I'm almost ready to say that you need to be in the VB.NET forum and if you are using VB.NET, well then you will need to PM a mod to have your thread moved...

Good Luck

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.