Computing.Net > Forums > Programming > VB.NET - value passing between form

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

VB.NET - value passing between form

Reply to Message Icon

Original Message
Name: redlcy
Date: December 5, 2004 at 19:55:35 Pacific
Subject: VB.NET - value passing between form
OS: winxp
CPU/Ram: 512
Comment:

hi:
anybody know how i use vb.net command to pass a string value from form1 to form2 for a process when a button in form1 clicked...thank


Report Offensive Message For Removal


Response Number 1
Name: kaepeekay
Date: December 5, 2004 at 20:17:15 Pacific
Reply: (edit)

You can redefine(overload) new constructor of form2

Form2 contains a constructor

Region-Windows Form Designer Generated Code
Public Sub New(Optional ByVal StrYourVariable As string)
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()

''Manipulate or use stryourvariable as you require

'Add any initialization after the InitializeComponent() call

End Sub


'form1-button_click

Dim frmFrom2 as form2
frmform2=new form2
frmform2.ShowDialog() (or) froform2.show


Report Offensive Follow Up For Removal

Response Number 2
Name: RichG
Date: December 8, 2004 at 18:34:52 Pacific
Reply: (edit)

If the two forms are in the same process.
While in form 1

form2.textbox1.value = "new value"

will pop it in there.


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History




Data Recovery Software