Recent: Fix food processor motor?

Mend Application Development

Mend Software, Application Development
Find out how to mend it for free.

Ask Question
Mend Software, Application Development
Mend repair fix application development

Mend > Application Development

Mend Change Example Button

How can I change the label.text value from another Form in VB.NET?

Could someone post an example showing how to change a label's text on one form, when a button is clicked on another form. (I know VB6, but I'm struggling with the basics in VB.NET)

Please keep it simple. I'm trying to understand how to address a control on one form from another form.

Thanks.

Jim
November 2003
how can i change the label.text to another label in the same form by click a button in the same form

Kelly
February 2006
This is the way I do it.

Add a module to yout project and add this line .....
Public formMain As _formMain
..... formMain is the name of the form concerned.

Also in the module add this Sub .....
Sub main()
formMain = New _formMain()
formMain.ShowDialog()
End Sub

You will need to change your project's properties so that Sub main is called when the application is started.

Now that formMain has been started as an instance, you can address it from another form or module. (Eg, formMain.label1.text="this works")

Noel
February 2004

Automatic Answer

We may have found other answers which could help you.

Click here for Change Example Button

Mend Software, Application Development
Mend repair fix application development

How to mend ...

Find out how to mend just about anything howtomendit.com for free repair help, information and advice.
Mend Software, Application Development
Mend repair fix application development