if you want to get the value of the property in form2 then make the property as public shared.
like this one
edit: no need to put public in shared property because in vb.net shared methodd by default is public where as in c# static methods cannot be accessed outside of the class if it's not declared public.VB Code:
'in your form2 Shared s As String Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click mystring() = TextBox1.Text Dim f As New Form1() f.ShowDialog() End Sub Public Shared Property mystring() As String Get Return s End Get Set(ByVal Value As String) s = Value End Set End Property 'in form1 'no need to instantiate the form2 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click MessageBox.Show(Form2.mystring()) End Sub




Reply With Quote