Display text in label depending on event

desperado

Well-known member
Joined
Oct 7, 2006
Messages
68
Programming Experience
Beginner
Hi everyone,

I was hoping someone out there could help me on some coding please, on my form I have a textbox, button,combobox and a label.

What I want to do is basically display details on the label, depending on the last action the user does. For example if the user enters something in the textbox and then presses on the command button i want that text in the textbox to be displayed in the label, however if the user selects something from the combobox straight after then that text from the combobox will replace the current text in the label and so forth. Also is it possible to add a word after the text in the combobox in the label?

If you don't understand then please let me know.

Regards.
 
Sorry I've solved the problem,

lbltitle.text = textbox1.text or the combobox1.text depending on the combobox or the textbox.
 
I would use an Enumeration for this to keep track of what was "done" last

Use a module level variable of the type of the enumeration
and declare the enum like so:
VB.NET:
  Friend Enum LastAction
    TextBox = 1
    ComboBox = 2
  End Enum

Now in the textChanged event, set the variable equal to 'TextBox'
In the SelectedIndexChanged event, set the variable equal to 'ComboBox'

Then when you need to know what was last done, test the variable. To display data in a label, use it's Text property
 
Back
Top