SpeakComputers.com online store
Electronics Software Computers Handhelds Laptops and Tablets Mobile Phones Digital Cameras Camcorders Games Music Books Sport Mens and Womens Watches Power Tools Household appliances

PRODUCTS

Software Downloads 2012 Software Mac Software Security Student Editions Windows 7 Office 2010

Sending information between SDI VB.NET Forms.

To send information or accessing functions from one form to another is easy with .NET Windows Forms.

Create an empty VB.NET Windows Forms project. On Form1, add a Button control and a Textbox control. Set the TextBox control to public access using the public keyword or in the properties set the Modifiers to public. In the Solutions Explorer create a second form named Form2 and add a single button control to form2.
On the Form1 button control click event add the following code.

Dim form2 As New Form2
//The following line adds form2 to the collection of owned forms, owned by form1.
Me.AddOwnedForm(form2)
//Call and show the form.
form2.Show()

On Form2 's button click event add the following code.

//Create a reference to form1.
Dim form1 As Form1 = Me.Owner
//Set the text value for form1 textbox1.
form1.TextBox1.Text = "Transfer Text";

Run the project and you can see just how easy it is to send information between SDI forms.

Sending information between MDI VB.NET Forms.

To send information or accessing functions from the MDI form to child forms is easy with .NET Windows Forms.

Create an empty VB.NET Windows Forms project. On Form1 set the IsMdiContainer to true, add a Button control and a Textbox control to the form. Set the TextBox control to public access using the public keyword or in the properties set the Modifiers to public. In the Solutions Explorer create a second form named Form2 and add a single button control to form2.
On the Form1 button control click event add the following code.

Dim form2 As New Form2
//Set Form2's MdiParent to Form1.
form2.MdiParent = Me
//Call and show the form.
form2.Show()

On Form2 's button click event add the following code.

//Create a reference to form1.
Dim form1 As Form1 = Me.MdiParent
//Set the text value for form1 textbox1.
form1.TextBox1.Text = "Transfer Text";


Home About Privacy Policy Resouces Search

Copy Right 2006 SpeakComputers.com - All Rights Reserved.