Hi to any an d all that read this thread.

I have a VB.NET App that creates forms from a template.
I am having problems getting them to communicate with each other.

Is it possible to send data from one textbox in the first instance to the same textbox in another instance.

EG

Names By Letter.

Dim NewNameWindow As New FormNameWindow()
NewNameWindow .Text = "Starts With *"
NewNameWindow .Show()

Where * would be the letter you click on.
Lets say i put the name in the wrong window by mistake - is it possible to send that text to the correct form.

Issue is all forms seem to be called FormNameWindow - and i can't reference them by potential form name.

any help would be welcome.

>Is it possible to send data from one textbox in the first instance to the same textbox in another instance.

Yes! but this controls must have public or friend accessibility. Check the Modifiers property of control.

Yes All Controls within the form are set to friend -
Is it also therefore possible to call button1_click in the form etc??

See if this helps.
New Project, 2 Forms ( 1 Button(on Form1), 1 Button (on Form2)).

Imports System.Reflection
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim myAssembly As Assembly = Assembly.GetExecutingAssembly()
        For Each myType As Type In myAssembly.GetTypes()
            If myType.Name = "Form2" Then
                Form2.Button1_Click(sender, e)
                Exit For
            End If
        Next
    End Sub
End Class
Public Class Form2

    Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MsgBox("Button1_Click on Form2.")
    End Sub
End Class

Edited 5 Years Ago by codeorder: n/a

This article has been dead for over six months. Start a new discussion instead.