Urgent + control array buttons + reading from a text file

gateway_2000
02-21-2003, 08:15 AM
i need to read information from a text file into a vb program.
I have 3 buttons(control array) and i need to input text to them,(for example think of a touch screen cash register and when you click on one of these buttons the right information should be put into that button - the only way i can think of doing this is by having a list of details in a text file so that when e.g.if a small drink medium or large, is pressed the program will optain this information from the text file so that when the button is pressed it will display it in the picture box to the user)
Can anyone help me
please reply asap.

Thanks

ALEX_0077
02-21-2003, 09:18 AM
your going to need an array of strings (if its string info) to hold the info you get from your file. Then, have an array of 'buttons' on your form. then, have something like this as a sub proceedure (assuming you have a button array named 'cmdButton' and a string array named 'strInfo'):


Private Sub cmdButton_Click(Index as integer)
cmdButton(Index).caption = strInfo(index)
End Sub

Chris J Locke
02-21-2003, 09:18 AM
Read information from a text file using 'line input'. Thats the easy bit.
An array of buttons is also easy ... cut and paste a button and the IDE sets up the array for you. Its nice like that. It wants to be your friend.
'...and printed in a pic box' is easy ... a picture box has a 'print' method. picture1.print "Hello Mum" (so long as autoredraw=true)
Now, pressing a button and 'the corresponding information will be read from the file'. Haven't got a clue what you mean - it depends on the structure of the text file. Is it one lump? You'll have to have it 'split' so you know what gets printed in a pic box. A good structure is the same for INI files:
[button1]
label=This is a label
text=This is the text

[button2]
label=This is another
text=Wow. This is more text

Etc. Easy to manage. API calls will fetch the text for you. Its a snap. BUT. If the file is laid out in another way, you'll have to parse the file by hand. Eurgh. Possible, but a lot of code. And I ain't typing it... ;-)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum