|
-
July 19th, 2005, 07:22 PM
#1
Sending information from Form1 to Form2
Hi,
I am trying to send information from Form1 to Form2 in VB.NET.
I got 2 radiobuttons on Form1. When we click them Form2 opens. when I click a button on Form2 i need to know which radio button was clicked on form1.
In Form1:radiobutton clicked: open form2
Dim myform2 as Form2
myform2.Show()
-------------
in form 2 button1 cilcked:
Dim myform1 as Form1
If myform1.radiobutton1.checked then // I am not able to get the information here.
Msgbox("radiobutton 1 clicked")
Else
Msgbox("radiobutton 2 clicked")
End If
Can anyone help me how to get the information from Form1.
Thank you.
-
July 19th, 2005, 07:34 PM
#2
Re: Sending information from Form1 to Form2
In Form1:radiobutton clicked: open form2
Dim myform2 as New Form2
myform2.myform1 = me
myform2.Show()
-------------
in form 2 button1 cilcked:
Dim myform1 as Form1
If myform1.radiobutton1.checked then // I am not able to get the information here.
Msgbox("radiobutton 1 clicked")
Else
Msgbox("radiobutton 2 clicked")
End If
Becarefull for this will reference everything on form1 with Form2. Better to just create a variable to hold the required information you want displayed in Form2. I.E.:
Dim myform2 as New Form2
myform2.checkedRadio = radiobutton1.text
myform2.Show()
-------------
in form 2:
Dim checkedRadio as string
Msgbox(checkedRadio)
-
July 21st, 2005, 04:55 AM
#3
Re: Sending information from Form1 to Form2
I have used a variable to hold the information.
Thanks a lot. It was very helpful.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|