| | |
Linking the text value from different forms
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Aug 2008
Posts: 28
Reputation:
Solved Threads: 0
Hello everybody.. Here I have a question regarding my “Budget System” project. It’s about to link the annual budget amount (txtBudget) from form 1 to the (txtBudget) in the form 2. It means that the system user have to set the value txtBudget in the form 1, so that it appears in the form 2 txtBudget, consequently to show the balance in txtBalance after being reducted using the MSFlexGrid codes below…
Hope you can guide me, how to link the txtBudget value in these Form 1 and Form 2. Do I need to use module, or database otherwise? But how it is? I had reviewed the book and hardly thought about it, but I can’t find the answer..
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub cmdCalculate_Click() Dim i As Integer Dim TAmt As Currency TAmt = 0 For i = 1 To Grd.Rows - 1 TAmt = TAmt + Val(Grd.TextMatrix(i, 7)) Next TAmt = Val(txtBudget.Text) - TAmt txtBalance.Text = Format(TAmt, "0.00") End Sub
Hope you can guide me, how to link the txtBudget value in these Form 1 and Form 2. Do I need to use module, or database otherwise? But how it is? I had reviewed the book and hardly thought about it, but I can’t find the answer..
I'm pretty sure the only way is to refer to the object and assign it directly. That is, something along the lines of:
vb Syntax (Toggle Plain Text)
form2.txtBudget.text = form1.txtBudget.text
•
•
Join Date: Aug 2008
Posts: 28
Reputation:
Solved Threads: 0
Thanx bro for your useful info. It works well, that i used code as below, modifying the code u gave.
In form 1
In form2
But, the problem is...it doesn't save the amount that i key in for the next usage, that i have to re-key in the budget amount everytime i use the system. Should i need to store the annual budget amount (from form 1) in a database, then put the second Data, (Data2) on the form 2? But how's the code to link the budget amount from the certain table in the database, to the calculation code in the form 2, so that when i click the cmdCalculate, it can show the balance in the txtBalance? Plz bro, help me..
In form 1
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub cmdConfirm_Click() Dim Budget08 As Currency Budget08 = TextBudget08.Text Form1.Label11.Caption = Budget08 Form2.TextBudget08.Text = Budget08 End Sub
In form2
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub cmdCalculate_Click() Dim i As Integer Dim TAmt As Currency TAmt = 0 For i = 1 To Grd.Rows - 1 TAmt = TAmt + Val(Grd.TextMatrix(i, 7)) Next TAmt = Val(TextStat08.Text) - TAmt txtBalance.Text = Format(TAmt, "0.00") End Sub
But, the problem is...it doesn't save the amount that i key in for the next usage, that i have to re-key in the budget amount everytime i use the system. Should i need to store the annual budget amount (from form 1) in a database, then put the second Data, (Data2) on the form 2? But how's the code to link the budget amount from the certain table in the database, to the calculation code in the form 2, so that when i click the cmdCalculate, it can show the balance in the txtBalance? Plz bro, help me..
![]() |
Similar Threads
- help in my linkin.... (VB.NET)
- Linking a Drop down menu option to a Mysql table. (MySQL)
- Linking up delphie forms (Pascal and Delphi)
- linking of two fields and updating database (Visual Basic 4 / 5 / 6)
- Linking Option buttons with text boxes (Visual Basic 4 / 5 / 6)
- Linking mysql output results (PHP)
- Displaying datagrid on second form (VB.NET)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: EXCEL VBA reporting in a target file
- Next Thread: printer layout problem
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






