the values of the form is missing?

kpao

Active member
Joined
Apr 3, 2006
Messages
29
Programming Experience
Beginner
Suppose I have two forms. one is Monitor, another is ConnectionProperties.
When I click connect button from Monitor, the ConnectionProperties form is popped up. After inputting the data in the ConnectionProperties form and pressed OK, the ConnectionProperties is hidden.
The source code of OK Button is :
VB.NET:
    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
        ipHost = txtAddress.Text
        Try
            port = Convert.ToInt16(txtPort.Text)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
        usrName = txtUserName.Text
        pwd = txtPassword.Text
 
        Me.Hide()  'usrName, pwd, ipHost, port are the fields of ConnectionProperties
    End Sub
However, When I click "connect" button from Monitor again, all of the values from the ConnectionProperties were disappeared. How can i restore these values?

t3.JPG


go to the ConnectionProperties again...
t4.JPG

:confused: :confused:
 
If you get a new piece of paper and write on it, then put that piece of paper away, then get another new piece of paper, would you be surprised that what you had written was not on the second piece of paper? I don't think you would. This is the exact same situation. You are creating a new form object, making changes to it, puttin it away, then creating another new form object that has no connection to the first other than thay are the same type. If you want to use the same form then you need to create a single form object and use it each time. The article suggested by zekeman is essential reading, as I have implied in my signature. Make sure you read all four parts.
 
Back
Top