Visual Basic 6 - Control Array

  Gaz W 15:13 29 Apr 2004

I have to create a program which in VB6 will basically be a security keypad.

Buttons (in a control array) for the numbers 0-9, a Clear button and an Enter button.

Text box at the top that shows the numbers in asterisks as they are entered, and another text box at the bottom.

When an incorrect code is entered, Access Denied appears in the text box at the bottom. When a correct code is entered, the name of a person appears in the bottom text box, and a picture and another text box appear to the right, with various details.

This (to me at least) is a very difficult thing to do and I would appreciate it if anyone could provide me with any links/information on how I'd go about this.

Basically I've got the layout of the form with the control array; the buttons 0-9 are called Number (creatively). What I can't do is get the numbers to come up in the top thing after each other, never mind in ***'s, and then it's how to make it load the image & text boxes up dynamically.

Sorry if this posting is a bit long and scattered but I've been trying for ages to work all of this out and I'm thinking different things I've done or could do all the time - none work though!

Any help would be much appreciated,


  scooby43 15:17 29 Apr 2004

I dont know much about VB my self you could try this though explains about using arrays.

click here

  Gaz W 17:19 29 Apr 2004

Thanks for that link scooby43.

I'm going through the page about control arrays (click here) and what I have now is the control array - buttons 0-9.

Now whenever I change the code to read something, it changes for every button. How do I get it to bring up - for now at least the numbers, in the top text box? Or am I missing the point?

  seedie 17:28 29 Apr 2004

Is this part of a college/uni course ?


  Gaz W 17:33 29 Apr 2004


Yes it is part of a course.

Let me make it clear though that basically I'm just trying to get as much information about and help on control arrays as I can to try and work out how to do this, not look for the answer.

Any help would still be appreciated because it's the most difficult thing I've had to do in VB and this is supposed to be simple!!!

  Gaz W 17:43 29 Apr 2004

By the way...

I was thinking that one way of doing this would be to use a blank image and a blank text box, but it's supposed to appear dynamically.

  seedie 17:46 29 Apr 2004

who may be able to help.

Good luck

  Gaz W 18:06 29 Apr 2004

My main problem is changing the code behind the command buttons - if I change the code behind one of them, it changes for all of them? How can I use them to represent the numbers 0 to 9?

  Gaz W 18:37 29 Apr 2004

Right, I've now managed to get it doing something at least. I've got my control array of buttons with the code in it:

Select Case Index
Case 0
Text1.Text = ("1")
Case 1
Text1.Text = ("2")
Case 2
Text1.Text = ("3")
Case 3
Text1.Text = ("4")
Case 4
Text1.Text = ("5")
Case 5
Text1.Text = ("6")
Case 6
Text1.Text = ("7")
Case 7
Text1.Text = ("8")
Case 8
Text1.Text = ("9")
Case 9
Text1.Text = ("0")
End Select

Now this only changes the Text1.Text to the last number pressed, and doesn't bring up *'s, although that can be sorted out I think more easily (I think).

  scooby43 13:56 30 Apr 2004

hm you could use a while loop ill have to get back into programming :)

  Gaz W 14:22 30 Apr 2004

Thanks everyone - got it sorted now.

It is to do with the indexes being different.

Thanks anyway for your help,


This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Xiaomi Mi Mix 2 review

See mcbess's iconic style animated for Mercedes-Benz

iPhone X news: Release date, price, new features & specs

Black Friday 2017 : date, sites participants & bonnes affaires