Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display variable values on form 2

Status
Not open for further replies.

PeteDabbler

Technical User
Oct 28, 2006
2
NZ
I have a procedure which generates several variables. I want to display them as a group on the form that activates the procedure. I can do them one at a time with MsgBox but I want to see them all together for user comparison before activating update of cells in the worksheet.
 
Thanks Skip and Gerry. I thought Label was a totally static text display item but now I look I see yes indeed you can change text in code. I figured there had to be something that did that and allowed you to group text items.
 
Actually, Labels are commonly under-utilized. I see many forms where people use textboxes to display text. This is not the correct use of textboxes. Textboxes are for user input.

If text is to be displayed (whether dynamically changed or static) a Label is the proper control. For a simple reason...a textbox allows (and again, is designed for) user changes. If the text to be displayed is what YOU want...why allow the user to change it?

For example, and this is similiar I think to what you are asking, I use a message area on userforms. Commonly I have it in a normally NON-visible part of the form. When the user clicks OK, and I do validation routines on their inputs, if things are OK, then fine, the code runs as it is supposed to do. If things are NOT OK (there are errors in the user input), I resize the form to show the message area. The message area is essentially a big Label. My validation routine bulds a string of error messages, which is displayed in the Label.

But there are many ways to do this. You could have the Label visible (but blank) all the time. It could be tied in with _Change events of othe rcontrols. As the user makes choices, enters text, the Label can be used to record and display current values.

Whatever. Yup, Label.Caption is useful on forms.

Gerry
My paintings and sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top