By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,020 Members | 940 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,020 IT Pros & Developers. It's quick & easy.

Pass values to existing open form

P: 64
Hi all,

I am using two forms.From form1 button click i am opening form2,and i am passing values to form2 using delegate.when i click the button again form2 shouldn't open again but values should pass to already open form(form2) here i am added tab pages in tab control for every button click in one form.

how to do this...anyone help me...thnax in advance

Expand|Select|Wrap|Line Numbers
  2. Form1 Code:
  4. Dim frm As Form
  6.             For Each frm In My.Application.OpenForms
  8.                 Dim x1 As String = frm.ToString()
  9.                 Dim x2 As String = My.Forms.Form2.ToString()
  10.                 If x1 = x2 Then
  12.                     MessageBox.Show("visible")
  14.                     Exit Sub
  15.                 End If
  16.             Next
  18.             im = New Form2 
  19.             im.Show()
  20.             Dim MyGreeting As GreetingDelegate
  21.             MyGreeting = New GreetingDelegate(AddressOf im.GoodMoring)
  22.             MyGreeting.Invoke(Textbox1.Text, Textbox2.Text)
  24. Form2 Code:
  25. Public Sub GoodMoring(ByVal Fname As String, ByVal Username As String)
  26.             _strfriendname = Fname
  27.             _strUsername = Username
  28.             Dim wbReceive As New WebBrowser
  29.             Me.ctlTabPages.Add(New TabPages.TabPage(_strfriendname, wbReceive, "Created: " & DateTime.Now.ToLongTimeString()))
  30.         End Sub
Nov 28 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.