| | |
need help with VB6
![]() |
•
•
Join Date: May 2009
Posts: 3
Reputation:
Solved Threads: 0
Hi
i have been working on a project for my younger brother. A simple VB6 and MS Access/SQL server based client-server database. For that i recently started working on VB6 as i previously had only worked on Java and C++. I have been consulting the book "Using Visual Basic 6" by Brian Siler and Jeff Spotts. Problem is embarassing enough in my first programe. When i try to compile it, it shows me an error "Compile error: Method or Data member not found". Program is very basic (Loan calculator) with four text fields, four labels(Principal, Annual Interest Rate, Term Year and Monthly payment) and two command buttons(Calculate Payment & Exit). I am sure that there is nothing wrong with the declaration or the syntax as it is absolutely according to the book still i am getting this error and i cant find anything about this error online or in the book. So i am stuck and need help.Can anyone please take a look into this. I would be much obliged.
i have been working on a project for my younger brother. A simple VB6 and MS Access/SQL server based client-server database. For that i recently started working on VB6 as i previously had only worked on Java and C++. I have been consulting the book "Using Visual Basic 6" by Brian Siler and Jeff Spotts. Problem is embarassing enough in my first programe. When i try to compile it, it shows me an error "Compile error: Method or Data member not found". Program is very basic (Loan calculator) with four text fields, four labels(Principal, Annual Interest Rate, Term Year and Monthly payment) and two command buttons(Calculate Payment & Exit). I am sure that there is nothing wrong with the declaration or the syntax as it is absolutely according to the book still i am getting this error and i cant find anything about this error online or in the book. So i am stuck and need help.Can anyone please take a look into this. I would be much obliged.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub cmdCalculate_Click() Dim cPrincipal As Currency Dim fIntRate As Single Dim nTerm As Integer Dim cPayment As Currency cPrincipal = Val(txtPrincipal.Text) fIntRate = Val(txtIntRate.Text) / 100 fIntRate = fIntRate / 12 nTerm = Val(txtTerm.Text) * 12 cPayment = cPrincipal * (fIntRate / (1 - (1 + fIntRate) ^ -nTerm)) txtPayment.Text = Format(cPayment, “Fixed”) End Sub Private Sub cmdExit_Click() End End Sub
•
•
Join Date: Mar 2009
Posts: 807
Reputation:
Solved Threads: 147
At the top of the code window, above all other code, do you see the words "Option Explicit"? If not, add these words and press F8. Your error, when you compile, should now be highlighted. Now, in the future so that this appears automatically, goto VB's menu Tools>Options and when the dialog appears, place a check next to where it says "Require Variable Declaration". Click OK.
Good Luck
Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.
Thanks
Thanks
•
•
Join Date: May 2009
Posts: 3
Reputation:
Solved Threads: 0
•
•
•
•
At the top of the code window, above all other code, do you see the words "Option Explicit"? If not, add these words and press F8. Your error, when you compile, should now be highlighted. Now, in the future so that this appears automatically, goto VB's menu Tools>Options and when the dialog appears, place a check next to where it says "Require Variable Declaration". Click OK.
Good Luck
Sorry for the delayed reply. The problem is still there. Though i have checked that Tools>Options>"Require Variable Declaration" still the problem remains the same. When i compile it same error comes up. i am attaching a printscreen of what it highlights when i break the compiling procedure, probably then you can see the problem. Thanks for your help and time. I really appreciate it.
X.
•
•
Join Date: Mar 2009
Posts: 807
Reputation:
Solved Threads: 147
First, if Option Explicit is not at the top of the code window, type it in.
Second, delete the .text and type in the dot (.). If textPrincipal is an actual control you should see the list of properties come up.
Now, it could be that you may have accidently renamed the control or perhaps misspelled the controls name in code so here is what I want you to do...
Go to the form view and select the textbox in question. Look in the properties window at the name property.
If it looks like the correct name then go back to the code window and remove everything after the open paren of the val function (val(....). Type in textp and hold down the CTRL key and press the space bar. Your textbox name should appear in the drop down list and if so just hit the tab key. Then type in the dot (.) and text should appear in the list BUT if you see caption then you have a label named as a text box.
Good Luck
Second, delete the .text and type in the dot (.). If textPrincipal is an actual control you should see the list of properties come up.
Now, it could be that you may have accidently renamed the control or perhaps misspelled the controls name in code so here is what I want you to do...
Go to the form view and select the textbox in question. Look in the properties window at the name property.
If it looks like the correct name then go back to the code window and remove everything after the open paren of the val function (val(....). Type in textp and hold down the CTRL key and press the space bar. Your textbox name should appear in the drop down list and if so just hit the tab key. Then type in the dot (.) and text should appear in the list BUT if you see caption then you have a label named as a text box.
Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.
Thanks
Thanks
![]() |
Similar Threads
- VB6 Database Program (Visual Basic 4 / 5 / 6)
- VB6 and MS Access 2002 (Visual Basic 4 / 5 / 6)
- "Error in linking List box with the VB6.0 database" (Visual Basic 4 / 5 / 6)
- New key word not recoginized in VB6 connecting to Access (Visual Basic 4 / 5 / 6)
- Deploying VB6 onto different platform (Visual Basic 4 / 5 / 6)
- XP and VB6 (Windows NT / 2000 / XP)
- Vb6 and XP (Visual Basic 4 / 5 / 6)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: SQL problem - simple?
- Next Thread: Uninstallation Problems with my Package in Visual Basic
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college 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 save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





