Question How to change the text of a label ,,,from a button that is in another form ?

edinet

Member
Joined
May 8, 2013
Messages
22
Programming Experience
Beginner
How to change the text of a label ,,,from a button that is in another form ?
example
i f button1 klick
label2 change the text "hello"

if button 2 click
label2 change the text to "vbdotnetforums"

buttona are from another form...
 
Assuming that the form containing the Label is the default instance of its type then it's as simple as
VB.NET:
FormName.LabelName.Text = "Hello World"
To learn what a default instance is, follow the Blog link in my signature and check out my post on the subject. Note that your application's startup form is the default instance of its type.
 
In case you didn't realise, I should mention that you need to handle the Click events of the Buttons and place the appropriate code inside the event handlers. If you didn't realise that though, you're missing some of the most basic principles of VB.NET programming, in which case you should do yourself a favour and learn those basic principles from a good beginners tutorial, e.g.

Microsoft Visual Basic .NET tutorials for Beginners
 
Back
Top