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

How to change label on form in a different class in the same project 1

Status
Not open for further replies.

paulcy82

Programmer
Jan 25, 2005
28
US
I have one proj, one class, and 3 modules. I have the form delcared in the class and I want to change a label at runtime in one of the modules. I cannot use ME. So how can I do this?
 
I understand that the form is you only form in your application. If so, try this:
Code:
Module Module1

    Public Sub asub()

        DirectCast(Form.ActiveForm, Form1).Label1.Text = "Text"

    End Sub

End Module
If you want to work more safely, make a property on Form1 that will change the label text and make your label private (in my code it is friend).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top