C
C#2y ago
Roji

Not understanding what I'm doing wrong

Idk if I'm missing something
120 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
pip
pip2y ago
int.Parse is trying to parse null
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
pip
pip2y ago
Ha beat you
Roji
Roji2y ago
lmao
pip
pip2y ago
where's my prize
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
pip
pip2y ago
Add some if statements for those inputs to make sure you're only int.Parse valid ints you can also use int.TryParse
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
pip
pip2y ago
yo, fair tbh
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
oh, but how do I make the combo box start with 0? when i start the program
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
how
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
yeah
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
this one?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
okay yeah it worked thanks
pip
pip2y ago
BOOM
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
pip
pip2y ago
it's the cinnamon toast crunch meme from 2002 "what the cinnamon toast fuck is this"
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
do you guys know how I can clear the radio box?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
yeah
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
still trying to figure out how
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
lets say I picked smalled but I changed my mind so I clicked clear the only thing clearing is the text box and the combo box but I want to uncheck the radio buttons to
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
under clear button right
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
yeah idk why it didn't change
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
oh
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
one more problem
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
that's right now I didn't do anything right
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
if you look at timbits right it shows 10 pack for 209 2.09
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
Roji
Roji2y ago
once I clicked calculate the tibits only shows the price idk what I'm doing wrong
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
pip
pip2y ago
when you click calculate it's clearing some of the text from the buttons show us the calc function again?
Roji
Roji2y ago
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
pip
pip2y ago
you're setting the text to the packs at the top, you can just delete that code i think or comment it out
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
which one? the const double?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
oh
pip
pip2y ago
yup
Roji
Roji2y ago
thanks
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
it worked
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
quick question for the price for the timbits I'm using a class level right
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
like that right
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
pip
pip2y ago
ye looks good to me
Roji
Roji2y ago
I'm using it correctly?
pip
pip2y ago
ye it looks good
Roji
Roji2y ago
then this would be useless
Roji
Roji2y ago
pip
pip2y ago
well no, you can define those at the class level too, then just do price = Pack_10; or something
Roji
Roji2y ago
Roji
Roji2y ago
being underlined
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
pip
pip2y ago
right, the const double Pack_10 is being defined locally, inside of the function. move those to the class instead
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
beside price I would just put Pack_10?
Roji
Roji2y ago
or int Pack_10?
pip
pip2y ago
tbh, you can just change it back to how you had it. what you had works tbh because idk how your app is structured i'm making a few guesses
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
pip
pip2y ago
alright peace out @niko
Roji
Roji2y ago
thanks and bye
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Roji
Roji2y ago
I'm not sure if this is gonna help but this is like the half of the code for timbits
pip
pip2y ago
well compile your program and see if it works what you had before worked right? before we started messing with const double Pack_10, etc
Roji
Roji2y ago
kk OHHHHHHHHHHHHH I forgot to add it maybe
Roji
Roji2y ago
but I forgot to add it to the final code
Roji
Roji2y ago
stuff
pip
pip2y ago
ahhh ok, so you may want to just grab the value of the timbits and add it to what you have and you should be good right?
Roji
Roji2y ago
I think so I'll take break first @pip my bad for the ping but quick question for the class lvl I did price = 1.90 right for the timbits but I have another code that shows prices wouldn't that just over ride the class level?
Roji
Roji2y ago
Roji
Roji2y ago
this worked
Roji
Roji2y ago
the price class level was working this "const double Pack_10 = 2.09;" code was useless
pip
pip2y ago
yea, those only work if something else is reading from them in your program. if nothing is reading from them then no reason to use them
Roji
Roji2y ago
oh okay
Roji
Roji2y ago
one more question how do I make the radio button work with the text box? If I click small it can only read the small one not the other ones
Roji
Roji2y ago
my bad if my explaining is bad
pip
pip2y ago
where you have the logic for your radio, hold references in that file to the text components. then you can do something like
if(button1.Checked == true) { //use the text from text1.Text }
if(button1.Checked == true) { //use the text from text1.Text }
or actually, you can do this in your main file if you hold references to everything there
Roji
Roji2y ago
I don't understand
pip
pip2y ago
can i see 100% of the file that has your calculate click function? you have component references in that file somewhere Like Small_One for example
Roji
Roji2y ago
pip
pip2y ago
that's the function, not the file you declared some stuff like Small_One, Medium_Two for example(unless you're getting that via inheritance)
Roji
Roji2y ago
@pip I already fixed it but now I have a different problem
Roji
Roji2y ago
on this line I'm not sure what I'm doing wrog
pip
pip2y ago
add a + in between the COFFE string and the Small string
Roji
Roji2y ago
oof
pip
pip2y ago
you're probably ToString() ing the wrong thing go to where that is in the program and you should be able to find the answer
Roji
Roji2y ago
?
pip
pip2y ago
probably somewhere else you can find it, just find out where it's relaying the text
Roji
Roji2y ago
the only Tostring I was able to find
pip
pip2y ago
go to wherever the logic for checkout is and find what it is printing
Roji
Roji2y ago
is it the result??
pip
pip2y ago
ye you're printing the object you need to print their text
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
pip
pip2y ago
we got through it i think pepecoffee
Roji
Roji2y ago
I kinda fixed it for the Total I'm not sure what I'm doing wrong but I'm just gonna move on