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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help. Displaying variables on form

Status
Not open for further replies.

slyr1338

Technical User
Nov 14, 2005
17
NZ
Hey guys.

Im new to visual basic and i was just wondering how i could display a variable on the form.

Cheers,
 
Hi slyr1338:

You might want to use a label control to display the variable. To update the contents that is displayed, use the code:
Code:
Label1.Caption = MyVariable
, where MyVariable is replaced with the name of your variable.

Welcome to the VB5/6 forum.


Cassie
PIII-500Mhz-128MB
Win98SE-VB6SP5
 
Hae,

This dose not work it gives me a error

'Caption' is not a member of 'System.Windows.Forms.Label'
 
Hi slyr1338,

CassandraR posted a solution that would work in VB5/6.

Looks to me like you are using VB.NET. In this case the syntax you would use (I believe) would be:
Code:
Label1.Text = MyVariable
It might be more helpful for you to post future questions in the VB.NET forum (Forum796), as this is a dedicated forum for the language I believe you are using.

Hope this helps

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
YES!! it worked sorry for the n00bieness

3.9 ghz
512mb
xp home SPK2
80g
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top