"Controll Arrays" in Visual Basic

Delta1

In Runtime
Messages
194
Is there any way in visual basic that I can easily manipulate controlls?

Basicly I want it so when a button is pressed, other buttons change depending.

So I could have it so if one button is pressed and say a value was three I could say Button3 diabled?

Sorry if this makes no sense, im a newbie in VB. I can see how this could be done in an array, but not how to do it to an object.
 
I've thought of a diffrent (prebbery better in my case) way of doing what im trying to do, but im still interested in any comments :)
 
Yeah sorry, it was late :D

I have a series of buttons, when I press one, based on a number value in a text box I want to disable another button,

so say I have a value of 2 in the box, and I press a button, I want the button thats 2 higher than the current to be disabled. Rather like if it was an array I was manipulating

(this is C++ because I know it better :p )

array[current+2]

If you get my meaning, rather than an array its a series of buttons I want to select,

Hope this makes sense :S

EDIT: One way I could do it is to have an array to manipulate and then update the status of all the buttons when one is clicked, but surely there is a more streamlined way to do this.
 
This was done with a text box, submit button, and 12 other buttons

Private Sub cmdSubmit_Click()

Dim Num As Integer

Num = txtNum.Text

'Since the control array starts at 1 do -1 unless you ' want to start your buttons at 0
cmdBTN(Num - 1).Enabled = False

End Sub
 
Back
Top Bottom