English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have a project in visual basic about vending machine program. How can I make the label display "item purchased" when the user purchased the item and then display "thank you" after item purchased?

2007-12-11 00:08:37 · 1 answers · asked by meme 1 in Computers & Internet Programming & Design

1 answers

You can use the Caption property to change what is displayed in a label.

When the user clicks a button to select the item place additional code it the buttons event handler.

myLabel.Caption = " Item Purchased"
'add one of the following
myLabelTimer.Enabled = True ' more on this below
btnDispenseProduct.Enabled = True

To further change the label you either place another message in another button event handler. I assume you would have a dispense product button that is activated after the purchase.

OR

Upon purchase of the item you start a timer and 5 seconds later the timer event fires which does the following:

Change the message to Thank You
Reset the vending selection buttons
Disables this timer to prevent triggering again until another button is pressed
Activate a second timer to limit the display of the Thank You message.

The second timer resets the label message and disables itself so as to run once

2007-12-11 00:47:43 · answer #1 · answered by MarkG 7 · 1 0

fedest.com, questions and answers