Not sure what I'm doing wrong but my Total Fare is messed up [Answered]
Numbers don't add up
![](https://utfs.io/f/fa70eb91-db03-4d23-b578-0360f08ee7e4-4pl4mu.png)
![](https://utfs.io/f/c96b9892-2e7f-45a5-a554-a5995a53be17-4pl4mu.png)
47 Replies
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
oh
soo I have to add them before?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
why?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I got it fixed
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
but now I have a different problems math problem 😦
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
so this is the example our teach gave us right
![](https://utfs.io/f/f3ad0451-d333-478d-a99d-6ef766b1c48e-4pl4mu.png)
if you look at the estimated fare
that's were I'm having problems because my Total fare is messed up
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
![](https://utfs.io/f/704d7b19-195d-4473-807f-1580647c78bd-4pl4mu.png)
here's my code for UberX
![](https://utfs.io/f/b20cca50-617d-4e1c-85e1-dadafc221f85-4pl4mu.png)
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
![](https://utfs.io/f/8a0f81d1-c638-4cf3-a621-84415dda3057-4pl4mu.png)
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
the value is the one I made
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
nvm I had XL
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
for Uber X
nvm Total fare still not matching up
![](https://utfs.io/f/c6f9a642-c934-45a4-8a15-9e25520cfd5c-4pl4mu.png)
Because you add 2 times bookingFeeX instead baseFare
ooooooooh
for the last part this is the example my teach gave me and this is what I got
![](https://utfs.io/f/1c0ff1f6-0212-4ad0-a224-f960d9e79670-4pl4mu.png)
![](https://utfs.io/f/d9aab268-85f4-4b97-b8d2-0b709eb38621-4pl4mu.png)
You're doing
ToString
on the textbox, you need to the Value
![](https://utfs.io/f/5da8f89e-d609-4a51-82eb-a8f5fa1fbc77-4pl4mu.png)
so I have to turn the textbox into a number?
This line is essentially textBox6.ToString()
![](https://utfs.io/f/dd6c1240-f3d5-4270-8e1d-9c13e207fb4d-4pl4mu.png)
oh
oh
if I didn't put ToString it would indefinity as a number right?
![](https://utfs.io/f/8b585a85-088b-452f-9fbc-fc0c70d7235c-4pl4mu.png)
The type TextBox has a property
Text
![](https://utfs.io/f/962f4b9d-9a5c-4f92-a824-0204615f8887-4pl4mu.png)
![](https://utfs.io/f/3923b7aa-d3ac-4cb6-b826-91c704f417cb-4pl4mu.png)
like that?
what type is textBox6?
what do you mean by type>
type?
In C# all variables, fields and properties have a type
here the type of the variable message is
string
![](https://utfs.io/f/a24dfe77-3b0b-4751-adb2-5f2fea692f87-4pl4mu.png)
![](https://utfs.io/f/ebaf7d7c-72a0-40e2-bf61-29a695ded630-4pl4mu.png)
I dont think it has a variable I didn't set it up yet
textBox6 is a control, right?
That textbox has a type, in the case of a textbox the type is
TextBox
ToString()
called on TextBox
doesn't return what is currently typed in itIt returns the type name that's why you get this
![](https://utfs.io/f/2ecce827-cb54-44f8-a7a6-fc41426e2c0b-4pl4mu.png)
Now to get the content's of a
TextBox
you have a property in TextBox
named Text
Yeah I just had to do .Text
✅ This post has been marked as answered!