raging_squid
09-05-2003, 02:22 AM
Its the first learning tut off allip.com site, its a order form but when i
push calculate nothing comes up please help
Private Sub frmOrder_Load()
End Sub
Private Sub cmdCalculate_Click()
txtTotal = txtPrice * txtQuantity
End Sub
Private Sub cmdExit_Click()
End
End Sub
Private Sub cmdItemFind_Click()
End Sub
Private Sub txtTotal_Change()
End Sub
Private Sub txtQuantity_Change()
End Sub
Private Sub txtPrice_Change()
End Sub
Private Sub txtItem_Change()
End Sub
wildfire1982
09-05-2003, 02:28 AM
If they are all referencing the correct name for the textboxes in your calculate sub, try using txtTotal = int(txtPrice) * int(txtQuantity)
That might be the problem but i have never encountered one where it wouldnt calculate from something like that. Looks fine to me but the int bit might force a calculation
raging_squid
09-05-2003, 02:31 AM
Nope sry but it still doesnt work is there something meant to be typed into the total text box. Because even if that code you gave me it still doesnt work sry. :(
kevin_verp
09-05-2003, 02:42 AM
Try this:
txtTotal.Text = Int(txtPrice.Text) * int(txtQuantity.Text)
Make sure "txtPrice.Text" and "txtQuantity.Text" have some input.
wildfire1982
09-05-2003, 02:43 AM
thats a bit strange, unless there is something obvious i cant see anything wrong with that. Are you a complete beginner? if u are i will ask a couple of questions just to make sure. No, there shouldnt be any need for anything to be typed into the total box but obviously you will need something in the others to calculate.
raging_squid
09-05-2003, 02:50 AM
yeh i completly new only started today
raging_squid
09-05-2003, 02:55 AM
i just exit the project and started a new one saved the .pjg or wat ever its called i open i again and all the code i typed is gone. what newbie mistake have i made now
bk2003
09-05-2003, 02:57 AM
Maybe I'm way off but anyway,
I see by your previus questions that you are a new to VB,
So are you really running the program??? In the menu RUN or by pressing F5
The other solution would be like the others have suggested, that the name of the controls on the form are different from the ones in the program code. Use the list in the top of the code window to find the control and their events.
(This is very basic, so I'm very sorry if I insult you in any way)
/BK
raging_squid
09-05-2003, 03:00 AM
narh no insult man its kool i know im hopeless at this but i will figure it out with you guys help soon. yes i have tryed runing the program but the 2nd part you said i didnt get it
wildfire1982
09-05-2003, 03:01 AM
Dont worry about that too much i think everyone has problems saving the files for the first time.
When you open the program, you are given the option to create a new project and then choosing standard .exe is the choice which would be best for you. Once this has been chosen,a form comes up which is blank. You add 3 textboxes and they, by default, will be named text1, text2 and text 3. So, in the properties section which is normally on the right hand side, you can see a property called name. so you change the names from text1 etc to total or whatever you want to call each of them. Then you put a command button as a calculate button, rename this to "calcButton" or whater and then double click on it to bring up the code window. Here, where the cursor is positioned, you type the code which you already have done.
Is this anything different to what you did?
loGin
09-05-2003, 03:04 AM
are you positive that txtTotal is the name of the
text box? if not, then vb will take it as a variable
and you wont get the answer unless you call it.
use Option Explicit in the declarations and if
an err raises thats it. are you sure there numbers in
the text boxes? have you tried using val()? Also
use the IsNumeric() boolean to make sure the
text boxes contains a number vb can work with.
raging_squid
09-05-2003, 03:06 AM
Yes i didnt even see that box there i thought that when they say type the name they mean the thing before _click() is where you put it do they have to be the same tho
raging_squid
09-05-2003, 03:10 AM
you guys rule i finaly did it. 2*3=6 that was my answer yes thank very much
wildfire1982
09-05-2003, 03:11 AM
aha, thats the problem, yes just in case u havent found it. In the properties box on the right is the name. You have to change it there and the code will update. Good luck with it.
You got it b4 i replied. Nice 1. Happy coding.