Click here to Skip to main content
15,898,036 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two Form and One Class, Both form has been connect via class A

Main Form One text box get the user input from text box and send it to edit for Class A,
ClassA Doing Some Modification and send to TextBox in Form2 to Display OutPut

I have tryed below Code But it shows Nothing

VB.NET
'01 ///Inside Form One Main Form
'------------------------------------------------------------------------------------------
Public Class Form1

    Private clasAObj As New ClassA

    '// Send to edit Class
    Sub sendToEdit()
        clasAObj.editText(TextBox1.Text.ToString)
    End Sub


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Form2.Show()
    End Sub
End Class


'----------------------------------------------------------------------------------------------------------
'02. //inside ClassA



Public Class ClassA

    Dim form2Obj As New Form2

    Sub editText(ByVal OriginalText As String)
        '/// Edit Like Something
        Dim EditText As String = OriginalText
        '/// Send to show form two text box
        form2Obj.ShowText(EditText)
    End Sub

End Class


'---------------------------------------------------------------------------------------------------------
'03. // Inside Form2

Public Class Form2
    Sub ShowText(ByVal receiveText As String)

        TextBox1.Text = receiveText.ToString & vbCrLf

    End Sub

End Class



if i send to msg mox it Shows. but for text its not working

Please help Me
Posted
Updated 7-Aug-16 9:16am
v2
Comments
Richard Deeming 5-Aug-16 9:57am    
Where's the code that calls the sendToEdit method?
Member 12278335 5-Aug-16 12:42pm    
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
sendToEdit()
End Sub
Member 12278335 5-Aug-16 12:42pm    
I Try with this but msg box only i can get but cant update text box.
CoderzF1 5-Aug-16 17:09pm    
in your class file, you are basically creating a whole new object when you declare form2obj that is never being shown. in the class file, above the line that says form2obj, add a line that reads form2obj = form 2
Richard Deeming 8-Aug-16 7:16am    
Good catch! You should post this as a solution. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900