VB 6 Small Program Check Me

skaterboi1234's Avatar, Join Date: Aug 2010
Newbie Member
Hi I want to develop program in Visual Basic 6, is a small program that lets you input any number from 1 to 5 and automatically display the corresponding number to its row. I have some screenshots i finish the design, my problem is the coding part. please help..here's my print screen screenshots. see the attachments thanks...
Attached Images
File Type: jpg Image1.JPG (60.8 KB, 6 views)
File Type: jpg Image2.JPG (62.7 KB, 3 views)
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Any reason to post it thrice?
0
virxen's Avatar, Join Date: Nov 2009
Pro contributor
first of all,you don't say which is the trigger you want to use.
1)as user types? text1_change()
2)after user press enter? text1_keypress()...if keyascii=13....


to do what you want you must create a control array of textboxes.
how you do that?
you have already 5 textboxes from 1 to 5 right?
lets assume that the first one is called text2 and the next text3 and so on.
you go to the properties of text3 and you change (name) property to text2
then vb asks you "you have already a textbox called text2 do you want to create a control array?" you choose yes.
you do the same for all remaining textboxes.

now the names are text2(0)->1 ,text2(1)->2,text2(2)->3......

and the last thing is
1)clear all textboxes when the trigger is executed(user pressed enter for example)
2)check the value if is within the limits you set 1-5
3)place the number entered into text2(x-1).text=cstr(x) where x the number between 1-5.

try this and if you cannot do it tell me to help you again.

Last edited by virxen; 2Aug2010 at 03:05..
shabbir like this
0
skaterboi1234's Avatar, Join Date: Aug 2010
Newbie Member
Sir thanks for the tips there, the 5 boxes is not a textbox is a label sir,which i want to use as a display output only, it can't be edited or type it.
0
skaterboi1234's Avatar, Join Date: Aug 2010
Newbie Member
Sir can u show it where do i put the codes? thanks
0
virxen's Avatar, Join Date: Nov 2009
Pro contributor
1) we create the form (foto 1)

2) we leave the first label (label7) as it is and click on label8
we go to its properties and we change its name to label7 (as the first one we left as it was)(fotos 2-3)

3)in the following question we press yes (foto 4)

4)we change the remain labels as we did in step 2(foto 5)
you see the name? label7(4) !!!

5) we go to properties and change all captions to null,nothing (foto 6)

6) and finally the coding....(foto 7)
Attached Images
File Type: jpg foto1.jpg (51.2 KB, 5 views)
File Type: jpg foto2.jpg (76.0 KB, 4 views)
File Type: jpg foto3.jpg (77.8 KB, 4 views)
File Type: jpg foto4.jpg (77.6 KB, 4 views)
File Type: jpg foto5.jpg (73.3 KB, 4 views)
File Type: jpg foto6.jpg (33.5 KB, 3 views)
File Type: jpg foto7.jpg (22.3 KB, 5 views)

Last edited by virxen; 3Aug2010 at 03:50..
shabbir like this
0
skaterboi1234's Avatar, Join Date: Aug 2010
Newbie Member
Thanks Sir that was clear and fantastic thanks so much......