Jump to content
Xtreme .Net Talk

Sending Data to the main form


Recommended Posts

Posted

In my main form I have the following code to call up another form;

 

Private Sub mnuPerennials_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuPerennials.Click

Dim PerennialsForm As New frmPerennials()

PerennialsForm.ShowDialog()

End Sub

 

in the PerennialsForm is the following code

 

Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click

Dim name As String = "warren"

Dim frmMain As New frmMain()

If chk1.Checked = True Then

frmMain.lstDisplay.Items.Add(name)

End If

Me.Close()

frmMain.Show()

End Sub

 

What I am trying to do is send a string back into the list box in the main form. With this code after the PerennialsForm closes, a new Main form opens, so now I have 2 main forms, but one of them has the String "Warren" in the list box. I have tried Me.Refresh() in the main form before the mnuPerennials_Click event ends (I take out the frmMain.Show()) thinking that all I need to do is refresh the main form, but the string is not there.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...