Talk2Tom11 Posted January 29, 2006 Posted January 29, 2006 I am working in VB.net and wondering if this is possible. What I want to do is declare thinks within a class. and then be able to call those items from any form within the project. for example in class1.vb i want to put Dim a as string a = "Text Example" and then be able to go into form1 and have a textbox.text equal to "a". Quote
Nate Bross Posted January 29, 2006 Posted January 29, 2006 Public Class MyClass Dim a As String Sub New(InitialValue as String) a = InitialValue End Sub Public Property TextValue As String Get Return a End Get Set (value As String) a = value End Set End Property End Class 'example usage Sub Button1_Click(.....) Dim mClass As New MyClass("Some Value") TextBox1.Text = mClass.TextValue End Sub Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.