| | |
Please help with passing data from one form to another form
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2006
Posts: 1
Reputation:
Solved Threads: 0
Hello!
I have a project to where I am making a pizza order for customers. My forms consist of a form for the pizza quantity and size (the cost is displayed in a lblDisplay.Text). I also have another form which calculates the cost of beverages.
I am now on the third form which calculates the cost of side items. I need to make it to where when the user clicks the submit button that the total of the side items is displayed along with adding the total of the pizzas and beverages of the other two forms. I dont know how to grab data from other forms.
I can make the other forms load by using the
Dim XXXX as new frmXXX
If my question is not clear enough, please let me know.
Adam
I have a project to where I am making a pizza order for customers. My forms consist of a form for the pizza quantity and size (the cost is displayed in a lblDisplay.Text). I also have another form which calculates the cost of beverages.
I am now on the third form which calculates the cost of side items. I need to make it to where when the user clicks the submit button that the total of the side items is displayed along with adding the total of the pizzas and beverages of the other two forms. I dont know how to grab data from other forms.
I can make the other forms load by using the
Dim XXXX as new frmXXX
If my question is not clear enough, please let me know.
Adam
•
•
Join Date: Apr 2006
Posts: 5
Reputation:
Solved Threads: 1
Hi Adam,
I will give the method , regardless about your project take the method then apply it with any project
There two common methods is used for passing data between forms
The first one is by creating a properties in the form that you want to pass the data on it
for example if you have two forms the the first one (name it Form1) include one textbox control and button , and when pressing button you want to pass the textbox text to the second form (name it Form2)
the property shold be like :
Note these codes in Form2
Then , when you are declaring Object from Form2 you just set The Value before Showing the Form
in the Form1 and in Button1 Click event write these lines :
by this way you have the text in the Form2 - variable _passedText
hope you get it , if you didnt I am here
The Second Method by Adding parameters to the Form that you need to pass the data on it in Sub New - I didnt like it , the Properties is better
Good Luck
I will give the method , regardless about your project take the method then apply it with any project
There two common methods is used for passing data between forms
The first one is by creating a properties in the form that you want to pass the data on it
for example if you have two forms the the first one (name it Form1) include one textbox control and button , and when pressing button you want to pass the textbox text to the second form (name it Form2)
the property shold be like :
Note these codes in Form2
VB.NET Syntax (Toggle Plain Text)
Private _passedText As String Public Property [PassedText]() As String Get Return _passedText End Get Set(ByVal Value As String) _passedText= Value End Set End Property
in the Form1 and in Button1 Click event write these lines :
VB.NET Syntax (Toggle Plain Text)
Dim Obj As New Form2 Obj.PassedText = TextBox1.Text Obj.Show
by this way you have the text in the Form2 - variable _passedText
hope you get it , if you didnt I am here
The Second Method by Adding parameters to the Form that you need to pass the data on it in Sub New - I didnt like it , the Properties is better
Good Luck
in vb 6 you can access it directly
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
nice to hear that.
happy coding friends...
happy coding friends...
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
•
•
Join Date: Dec 2008
Posts: 42
Reputation:
Solved Threads: 0
•
•
•
•
Hi Adam,
I will give the method , regardless about your project take the method then apply it with any project
There two common methods is used for passing data between forms
The first one is by creating a properties in the form that you want to pass the data on it
for example if you have two forms the the first one (name it Form1) include one textbox control and button , and when pressing button you want to pass the textbox text to the second form (name it Form2)
the property shold be like :
Note these codes in Form2
Then , when you are declaring Object from Form2 you just set The Value before Showing the FormVB.NET Syntax (Toggle Plain Text)
Private _passedText As String Public Property [PassedText]() As String Get Return _passedText End Get Set(ByVal Value As String) _passedText= Value End Set End Property
in the Form1 and in Button1 Click event write these lines :
VB.NET Syntax (Toggle Plain Text)
Dim Obj As New Form2 Obj.PassedText = TextBox1.Text Obj.Show
by this way you have the text in the Form2 - variable _passedText
hope you get it , if you didnt I am here
The Second Method by Adding parameters to the Form that you need to pass the data on it in Sub New - I didnt like it , the Properties is better
Good Luck
Whats the function of obj.Show here?
![]() |
Similar Threads
- Passing data from forms from one page to another (JavaScript / DHTML / AJAX)
- passing values from a form to a dialog form (VB.NET)
- Passing data from datagridview to textboxes (VB.NET)
- passing data using multiple form styles (HTML and CSS)
- Product List and Order Form Submit (JavaScript / DHTML / AJAX)
- get posted form data in python (Python)
- Dialog Box alongwith Form (Visual Basic 4 / 5 / 6)
Other Threads in the VB.NET Forum
| Thread Tools | Search this Thread |
.net .net2008 2008 access account add advanced application array basic beginner browser button buttons click code combo cpu cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic employees excel exists fade filter forms generatetags html images input intel internet listview mobile module monitor mysql net number objects open panel pdf picturebox picturebox2 port position print printing printpreview problem regex reuse right-to-left save search searchvb.net select serial settings shutdown socket sqldatbase sqlserver storedprocedure survey temperature textbox timer timespan transparency txttoxmlconverter update user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vba vbnet vista visual visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year






