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?

Recommended Answers

All 2 Replies

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

it's VB 2008. I assumed it would be similar, but I'm pretty new to this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.