Currency
-
sorry about that.. i tried. ok, I have put that in.. have not tried one more error. if I have $0.00 dollars as the amount for a box additonalguestcharge.text I put... additionalguesstcharge.text = format(0,"currency") getting an error..but of course. now what. By the way thanks for all the input. Thank you, ibok23
Try this... Dim amount as double amount = 10.5 Console.Writeline(amount.ToString("C")) Free your mind...
-
sorry about that.. i tried. ok, I have put that in.. have not tried one more error. if I have $0.00 dollars as the amount for a box additonalguestcharge.text I put... additionalguesstcharge.text = format(0,"currency") getting an error..but of course. now what. By the way thanks for all the input. Thank you, ibok23
maybe try
Console.Writeline(Format(0,"$#,###0.00"))
i havent tried this but i remember i used something just like it before, i forget exactly what it was. mess around with that if it gives an error. itll b just around the corner. ------------------------ Jordan. III
-
sorry about that.. i tried. ok, I have put that in.. have not tried one more error. if I have $0.00 dollars as the amount for a box additonalguestcharge.text I put... additionalguesstcharge.text = format(0,"currency") getting an error..but of course. now what. By the way thanks for all the input. Thank you, ibok23
First, what's the error? RageInTheMachine9532
-
First, what's the error? RageInTheMachine9532
-
First, what's the error? RageInTheMachine9532
I finally got it done. Now i am haveing problems with my total. I am trying to add three boxes together. I love math and I know what to do. I put total.text = ((subtotal.text) + (additionalguestcharge.text) + (rollbed.text)) in my answer it gives me $209.00$5.00$10.00 instead of adding it up. This is weird. Thank you, ibok23
-
I finally got it done. Now i am haveing problems with my total. I am trying to add three boxes together. I love math and I know what to do. I put total.text = ((subtotal.text) + (additionalguestcharge.text) + (rollbed.text)) in my answer it gives me $209.00$5.00$10.00 instead of adding it up. This is weird. Thank you, ibok23
-
I finally got it done. Now i am haveing problems with my total. I am trying to add three boxes together. I love math and I know what to do. I put total.text = ((subtotal.text) + (additionalguestcharge.text) + (rollbed.text)) in my answer it gives me $209.00$5.00$10.00 instead of adding it up. This is weird. Thank you, ibok23
ibok23 wrote: total.text = ((subtotal.text) + (additionalguestcharge.text) + (rollbed.text)) That's because you adding String of characters together, not number values. What's going to make you redesign your code is the fact the the numbers you see in the TextBoxs can't be used in calculations. TextBoxs are lousy places to keep number values. You should only use them to display results. Since I can't see all of your code, I can't tell you exactly what you have to do to make things right, but I can tell you you need to keep the value you use in calculations in numeric type variables. You also need to rename your TextBoxes so that their names don't conflict with any other variable names. I would suggest renaming them with a 'txt' prefex, like this:
total becomes txtTotal subtotal becomes txtSubTotal additionalguestcharge becomes txtAdditionalGuestCharge ...
Now, keep your numeric values in variables something like this:
Dim subtotal As Double Dim additionalguestcharge as Double Dim rollbed as Double Dim total as Double total = subtotal + additionalguestcharge + rollbed txtTotal.Text = Format(total, "C")
Get the idea? RageInTheMachine9532
-
I finally got it done. Now i am haveing problems with my total. I am trying to add three boxes together. I love math and I know what to do. I put total.text = ((subtotal.text) + (additionalguestcharge.text) + (rollbed.text)) in my answer it gives me $209.00$5.00$10.00 instead of adding it up. This is weird. Thank you, ibok23
when adding text in labels, textboxes, etc etc, you must convert them to a number first. they are concatenating (putting together) the text, with what you are doing right now. do something like:
total.text = CInt(CInt(subtotal.text) + CInt(additionalguestcharge.text) + CInt(rollbed.text))
------------------------ Jordan. III -
ibok23 wrote: total.text = ((subtotal.text) + (additionalguestcharge.text) + (rollbed.text)) That's because you adding String of characters together, not number values. What's going to make you redesign your code is the fact the the numbers you see in the TextBoxs can't be used in calculations. TextBoxs are lousy places to keep number values. You should only use them to display results. Since I can't see all of your code, I can't tell you exactly what you have to do to make things right, but I can tell you you need to keep the value you use in calculations in numeric type variables. You also need to rename your TextBoxes so that their names don't conflict with any other variable names. I would suggest renaming them with a 'txt' prefex, like this:
total becomes txtTotal subtotal becomes txtSubTotal additionalguestcharge becomes txtAdditionalGuestCharge ...
Now, keep your numeric values in variables something like this:
Dim subtotal As Double Dim additionalguestcharge as Double Dim rollbed as Double Dim total as Double total = subtotal + additionalguestcharge + rollbed txtTotal.Text = Format(total, "C")
Get the idea? RageInTheMachine9532
Thanks - I see what I was doing wrong, I don't understand it all the way, but I do see. Now one more question if you don't mind How do you get to set a date picker back to the current date when you push the clear button? I want them to be able when they push the clear button to default back to the current date.
-
Thanks - I see what I was doing wrong, I don't understand it all the way, but I do see. Now one more question if you don't mind How do you get to set a date picker back to the current date when you push the clear button? I want them to be able when they push the clear button to default back to the current date.
Anonymous wrote: I want them to be able when they push the clear button to default back to the current date. Easy enough ... just set the Value property of the DateTimePicker control to the current Date using Now(). Put this code in the handler for the Clear button click:
dtpArrival.Value = Now() dtpCheckout.Value = Now()
RageInTheMachine9532