Problem with forms and their names

Discussion in 'Visual Basic ( VB )' started by CaJack, Jan 4, 2008.

  1. CaJack

    CaJack New Member

    Mar 21, 2007
    Likes Received:
    Trophy Points:
    Hi, I’m having trouble with my application. I can’t seem to get forms to communicate together. I’ve started off with a simple test like this:
    Form2.Label1.Text = "hello"
    Here’s the code that creates my forms from my main menu class:
    (I should explain that my main menu form has a textbox and a button, when the user types something in and clicks the button a new form is created.)
    Public Class MainMenuClass
        Dim mynum As String
        Private frm_MainMenu As MainMenuForm
        Public TestArray As New ArrayList
        Private c_NewForm As NewFormClass
        Public Sub New(ByVal frm As MainMenuForm)
            frm_MainMenu = frm
        End Sub
        Public Sub createNewForm(ByVal Uinput As String)
            c_NewForm = New NewFormClass(Uinput, Me)
        End Sub
    If 2 new forms are created and the user input the names “joe” and “bob” for them, that should be one newform called joe and one called bob. And each has there own newform class. From each of the new forms the user can type into a textbox and click a button to see if there is a form open with that name. I have tried many things and I cant figure out how to pass the name from the textbox to a string to be used like this:
    Dim TestString as String = textbox.1.text
    TestString.Label1.Text = "hello"
    Any help would be great, thanks.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice