C
C#13mo ago
Rykorra

✅ Help Validating user inputs into Text Boxes

I am currently a student in a C# class we have a shipping Calculator project due and I am having problems making sure that only North, South, East, and West is input into the zone text box please help? I am also having to use a switch {case...} for determining the cost for the shipment, If i could possible get some help with that as well that would be great.
237 Replies
Rykorra
RykorraOP13mo ago
My class uses visual studio if you would need to have that information.
JakenVeina
JakenVeina13mo ago
$details
MODiX
MODiX13mo ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
Rykorra
RykorraOP13mo ago
So I don't think my code will help at this time because I think a majority of it is incorrect for what I need to do for this project is there maybe some other way I can get you the info you need. I can upload my assignment sheet or maybe get you in a voice chat? Here is the code I have anyways https://paste.mod.gg/ncpvtydszvvu/0
BlazeBin - ncpvtydszvvu
A tool for sharing your source code with the world!
JakenVeina
JakenVeina13mo ago
so you have a textbox and you want to limit the user to only inputting "North", "South", "East", and "West"?
Rykorra
RykorraOP13mo ago
correct VALIDATION: Validate that the package weight entered is numeric and greater than zero. Validate that a non-blank shipping zone letter code was entered. If the user entered a shipping zone letter code other than the valid codes mentioned below, then display an error message indicating this to the user, and do not calculate the shipping costs. this is the exact wording the professor used
JakenVeina
JakenVeina13mo ago
ah so no you do not want to limit the user to only inputting "North", "South", "East", and "West" you want to limit the user to only inputting some "zone letter code" values what are the valid "zone letter code"s
Rykorra
RykorraOP13mo ago
N S E W
JakenVeina
JakenVeina13mo ago
also, that doesn't specify use of a "textbox" anywhere don't use a textbox unless that's specified somewhere else in the problem
Rykorra
RykorraOP13mo ago
INPUT: Create text boxes to accept the input of a package’s weight and another text box to accept the input of a shipping zone letter code (assume shipping zone letter codes of N, S, E, W) with zone rates as described below.
JakenVeina
JakenVeina13mo ago
use a dropdown selector or radio buttons okay so
Validate that a non-blank shipping zone letter code was entered
If the user entered a shipping zone letter code other than the valid codes mentioned below, then display an error message indicating this to the user
so, what are you having trouble with?
Rykorra
RykorraOP13mo ago
If I am going to be honest most everything with this course so far. I can look at code and understand what things are going to do but I am having a hard time determining where code needs to go. I understand what I am needing to do. Just do not know how to execute it.
JakenVeina
JakenVeina13mo ago
cracks knuckles where do you want to start?
Rykorra
RykorraOP13mo ago
I guess with my first bit i have to do. which is that input section you saw
JakenVeina
JakenVeina13mo ago
the shipping zone bit?
Rykorra
RykorraOP13mo ago
JakenVeina
JakenVeina13mo ago
lovely aha AND you have a calculate button that is very telling
Rykorra
RykorraOP13mo ago
yes making sure i can validate the letter codes
JakenVeina
JakenVeina13mo ago
so A) you need input controls which you have B) you need to DO something with them when are we going to DO things?
Rykorra
RykorraOP13mo ago
when text is added into the text box? or when the calculate button is pressed?
JakenVeina
JakenVeina13mo ago
does the problem specify? if not, what makes more sense to you?
Rykorra
RykorraOP13mo ago
it does not specify but for me it would be when the calculate button is pressed
JakenVeina
JakenVeina13mo ago
I would agree if you're going to HAVE a calculate button, that indicates to the user that they're responsible for making things happen you definitely COULD have things automatically update whenever text is entered but then what's the point of having a button at all? so, now our job is "write code to run when the button is clicked"
Rykorra
RykorraOP13mo ago
exactly i think i have been doing that in line 28
JakenVeina
JakenVeina13mo ago
assuming that method is attached to the Click event of the calculate button, yes the other handlers you can get rid of now, what do we need to DO within that method?
Rykorra
RykorraOP13mo ago
the shipzonetb_ttextchanged and the packwght tb_text changed?
JakenVeina
JakenVeina13mo ago
you wanted to start with the shipping zone input? yes, we've just established you don't want to do anything when text changes
Rykorra
RykorraOP13mo ago
okay one sec
Rykorra
RykorraOP13mo ago
I am getting errors
JakenVeina
JakenVeina13mo ago
what do they say? rather, what do you think they're telling you? what does that text mean?
Rykorra
RykorraOP13mo ago
that there was a function given to those events and the code no longer has the event trigger
JakenVeina
JakenVeina13mo ago
roughly correct you have removed the methods you did not remove other code that refers to those methods the code that actually attaches those methods to the textbox events double-click on the error to see
Rykorra
RykorraOP13mo ago
ahh okay we have not got to the designer yet in class
JakenVeina
JakenVeina13mo ago
I mean you're using it so, yeah, you have you're getting a peek into what the Designer DOES for you, which is that it just generates C# code don't edit that file but that file didn't come from nowhere if the Designer generated a reference to a method that doesn't exist, that's becuase you told it to go into the Designer and remove the thing that tells it to do that
Rykorra
RykorraOP13mo ago
awesome okay got it The total shipping cost amount is equal to the ‘weight cost’ plus the ‘zone cost’ and is calculated as follows: $18.00 PER POUND ‘weight cost’ PLUS: $27.00 ‘zone cost’ FLAT surcharge if shipped to zone N $36.00 ‘zone cost’ FLAT surcharge if shipped to zone S $45.00 ‘zone cost’ FLAT surcharge if shipped to zone E $54.00 ‘zone cost’ FLAT surcharge if shipped to zone W this is also how he wants us to price out things figured i would give you this as well since it will be relevant
JakenVeina
JakenVeina13mo ago
I saw what are we working on right now?
Rykorra
RykorraOP13mo ago
I would say lets start with the Shipping zone code and making sure that the correct zone cost is put in
JakenVeina
JakenVeina13mo ago
great what do we need to do with the shipping zone code?
Rykorra
RykorraOP13mo ago
ensure that the N S E W are put into the Shipping zone TB
JakenVeina
JakenVeina13mo ago
what does our code need to do in order to accomplish that
Rykorra
RykorraOP13mo ago
read the text box for that text and if it does not read any of those zone codes then display to enter a valid code
JakenVeina
JakenVeina13mo ago
read the text box for that text
what's the code for this?
Rykorra
RykorraOP13mo ago
would that be a .Parse?
JakenVeina
JakenVeina13mo ago
which .Parse()?
Rykorra
RykorraOP13mo ago
.Parse(ShipZoneTB.text)?
JakenVeina
JakenVeina13mo ago
what are you calling .Parse() on? there's a lot of different .Parse() methods out there which one are you talking about?
Rykorra
RykorraOP13mo ago
ahhhh So i would start with north so maybe zoneN = ___.Parse(ShipZoneTB.Text)?
JakenVeina
JakenVeina13mo ago
uhm no also no
Rykorra
RykorraOP13mo ago
dang
JakenVeina
JakenVeina13mo ago
you're getting farther and farther from the actual question
read the text box for that text
how do you read text from a text box?
Rykorra
RykorraOP13mo ago
decimal.Parse(ShipZoneTB.Text) I feel like that is wrong cause that would be a number no?
JakenVeina
JakenVeina13mo ago
it would I mean it's also kinda right
Rykorra
RykorraOP13mo ago
int?
JakenVeina
JakenVeina13mo ago
but yeah, why are you parsing the text into a decimal? do we WANT a decimal?
Rykorra
RykorraOP13mo ago
no we want a letter Isletter.Parse?
JakenVeina
JakenVeina13mo ago
why are you so stuck on a Parse method?
read the text box for that text
where in here are we discussing parsing text?
var shipZoneCode = ShipZoneTB.Text;
var shipZoneCode = ShipZoneTB.Text;
Rykorra
RykorraOP13mo ago
I am not sure I apologize
JakenVeina
JakenVeina13mo ago
nothing to apologize for so, next step
if it does not read any of those zone codes
what's the code we need for this?
Rykorra
RykorraOP13mo ago
I am not sure exactly.
JakenVeina
JakenVeina13mo ago
well, the word "if" in that sentence should be your biggest clue
Rykorra
RykorraOP13mo ago
okay so if (ShipZoneTB.Text
JakenVeina
JakenVeina13mo ago
you can do that, if you want or you can use the variable, like I demonstrated above
Rykorra
RykorraOP13mo ago
if (shipZoneCode
JakenVeina
JakenVeina13mo ago
since we're going to be checking the text value multiple times, probably better to use a reusable vairable and what are we checking shipZoneCode for?
Rykorra
RykorraOP13mo ago
if (shipZoneCode is "N" etc?
JakenVeina
JakenVeina13mo ago
try it
Rykorra
RykorraOP13mo ago
says cannot implicitly conver type 'string' to system windows form tb
JakenVeina
JakenVeina13mo ago
on what code?
Rykorra
RykorraOP13mo ago
if (shipZoneCode is "n");
JakenVeina
JakenVeina13mo ago
what is shipZoneCode?
Rykorra
RykorraOP13mo ago
ShipZoneTB?
JakenVeina
JakenVeina13mo ago
why? is that what we said we needed? a reference to the entire textbox?
Rykorra
RykorraOP13mo ago
no just the text inside it
JakenVeina
JakenVeina13mo ago
so, what is the code you wrote to do that?
Rykorra
RykorraOP13mo ago
I don't think I have written that yet?
JakenVeina
JakenVeina13mo ago
so... do it
Rykorra
RykorraOP13mo ago
I apologize for taking up an hour of your time. I seem to not be able to understand what is needed. I will speak with my professor about it when I see him next. Thank you giving me your insight though it meant a lot.
JakenVeina
JakenVeina13mo ago
I'm just chillin' working on other stuff you're not imposing at all, that's what I'm here for I'm good to keep going if you are recap:
Validate that a non-blank shipping zone letter code was entered
If the user entered a shipping zone letter code other than the valid codes mentioned below, then display an error message indicating this to the user
this is what we need to do which you then distilled down to this
read the text box for that text and if it does not read any of those zone codes then display to enter a valid code
then we identified the first stop of that, and wrote code for it
read the text box for that text
var shipZoneCode = ShipZoneTB.Text;
var shipZoneCode = ShipZoneTB.Text;
now, we're working on the second step
if it does not read any of those zone codes
for which you wrote
if (shipZoneCode is "n");
if (shipZoneCode is "n");
you said that was giving you an error, and then you told me you never added the first bit of code that we wrote to your actual program you need to do that
Rykorra
RykorraOP13mo ago
okay I am good to keep going I have added the var shipZoneCode = ShipZoneTB.text;
Rykorra
RykorraOP13mo ago
this is the error code it is giving me
JakenVeina
JakenVeina13mo ago
on what line of code?
Rykorra
RykorraOP13mo ago
if (shipZoneCode is "n")
JakenVeina
JakenVeina13mo ago
and what is shipZoneCode?
Rykorra
RykorraOP13mo ago
var shipZoneCode = ShipZoneTB;
JakenVeina
JakenVeina13mo ago
so when you said you in fact did not do this you have defined a variable shipZoneCode and given a value of ShipZoneTB I.E. a reference to the entire texbox then, you are attempting to compare that TextBox object against a string literal and the compiler correctly tells you that's nonsense there is no automatic conversion between those types
Rykorra
RykorraOP13mo ago
so i need to define other variables?
JakenVeina
JakenVeina13mo ago
no, you need to take the line of code that we wrote here in Discord and put it in your program correctly
Rykorra
RykorraOP13mo ago
just so i am clear the var needs to be changed correct?
JakenVeina
JakenVeina13mo ago
no
var shipZoneCode = ShipZoneTB.Text;
var shipZoneCode = ShipZoneTB.Text;
var shipZoneCode = ShipZoneTB;
var shipZoneCode = ShipZoneTB;
what is the difference between these two lines?
Rykorra
RykorraOP13mo ago
this? the first looks at the text as the other looks at the box gotcha got it no error I have added if statements for all the directions into the code
JakenVeina
JakenVeina13mo ago
let's see
Rykorra
RykorraOP13mo ago
BlazeBin - zctrgqycjuwc
A tool for sharing your source code with the world!
Rykorra
RykorraOP13mo ago
So now i need to add the is not one of those to have a message box that says please use one of them
JakenVeina
JakenVeina13mo ago
how do you want to display that message to the user?
Rykorra
RykorraOP13mo ago
would that be an else statement?
JakenVeina
JakenVeina13mo ago
that would be one way to accomplish it doesn't fit with what you've written so far
Rykorra
RykorraOP13mo ago
okay what do you recommend?
JakenVeina
JakenVeina13mo ago
I'm going to recommend that you do what makes sense to you
Rykorra
RykorraOP13mo ago
what makes sense to me would be to have a message box pop up saying "Please enter a valid Zone Code"
JakenVeina
JakenVeina13mo ago
great let's do that what's the code to do that?
Rykorra
RykorraOP13mo ago
MessageBox.Show("Please Enter A Valid Zone Code");
JakenVeina
JakenVeina13mo ago
looks good to me now, where do we put that? I.E. when do we want that to run?
Rykorra
RykorraOP13mo ago
when the calc button is clicked I have it right now under my if statements
JakenVeina
JakenVeina13mo ago
when the button is clicked, sure, but ALWAYS when the button is clicked?
Rykorra
RykorraOP13mo ago
i see why you asked that question cause it still popped up hmm
JakenVeina
JakenVeina13mo ago
you only want it to run when the ship code isn't one of the 4 acceptable values, yes?
Rykorra
RykorraOP13mo ago
yes
JakenVeina
JakenVeina13mo ago
so, we need to put it somewhere the only runs when that is the case I.E. we need the program to make a decision about when to run it
Rykorra
RykorraOP13mo ago
hmmm I am unsure maybe after the button is clicked but after it checks for the shipZoneCode?
JakenVeina
JakenVeina13mo ago
how do we make decisions in code?
Rykorra
RykorraOP13mo ago
else MessageBox.Show("Please Enter A Valid Zone Code");? no that is not correct
Rykorra
RykorraOP13mo ago
but that is displaying 4 of the message boxes
JakenVeina
JakenVeina13mo ago
indeed that's what you told it to do "if the code isn't n, display a message box" "if the code isn't s, display a message box" "if the code isn't e, display a message box" "if the code isn't w, display a message box"
Rykorra
RykorraOP13mo ago
so i need to do is not one of those display the message box
JakenVeina
JakenVeina13mo ago
uhmm rephrase, please?
Rykorra
RykorraOP13mo ago
is the text is no NSEW MessageBox.Show("Please Enter A Valid Zone Code");
JakenVeina
JakenVeina13mo ago
yeah if the code is NONE of those I.E. if ALL of those statements are true "if the code isn't n AND the code isn't s AND ..."
Rykorra
RykorraOP13mo ago
it says the "not pattern" is not available in C# 7.3 please use language version 9.0 or greater if (shipZoneCode is not "n"(MessageBox.Show("Please Enter A Valid Zone Code")); this is what I was trying to do I am not sure where to put this message box i found this "&&" I feel like this needs to be in this code
JakenVeina
JakenVeina13mo ago
yeah, you can't use is not in C# 7.3 use != that is how you would combine conditions, to check whether all of them are true at once, definitely
Rykorra
RykorraOP13mo ago
okay so these would be more if statements? or would this be an else
JakenVeina
JakenVeina13mo ago
both are possible if you were going to do it as a single if statement, what would that look like? any idea?
Rykorra
RykorraOP13mo ago
else if (shipZoneCode != " " ) { MessageBox.Show ("Please enter a valid zone code") } ?
JakenVeina
JakenVeina13mo ago
that looks like an else if to me not "a single if statement"
Rykorra
RykorraOP13mo ago
if (shipZoneCode != "n" ) { MessageBox.Show ("Please enter a valid zone code") }
JakenVeina
JakenVeina13mo ago
okay, but you already have that and it didn't work we were talking about how to check that the code is NONE of the 4 valid values in a single if statement
Rykorra
RykorraOP13mo ago
I dont know how i would do that
Angius
Angius13mo ago
Hint: &&
JakenVeina
JakenVeina13mo ago
less-obvious hint: you already mentioned it earlier
Rykorra
RykorraOP13mo ago
I am guessing you mean &&
JakenVeina
JakenVeina13mo ago
indeed
Rykorra
RykorraOP13mo ago
if (shipZoneCode != "n" && "s" && "e" && "w")? { MessageBox.Show ("Please enter a valid zone code") }
Angius
Angius13mo ago
Almost
Rykorra
RykorraOP13mo ago
else?
Angius
Angius13mo ago
&& is a boolean operator It works on booleans bool && bool shipZoneCode != "n" will resolve to a boolean But "s" is a string
JakenVeina
JakenVeina13mo ago
Alternatively, look at the error that gives you. It tells you that you can't convert a string to a bool, yes? That's meaningful, it tells you that you're passing a string to something that expects a bool.
Rykorra
RykorraOP13mo ago
okay i see that error what should i do to fix it?
JakenVeina
JakenVeina13mo ago
don't pass a string to something that expects a boolean consider what Z said about how && works and consider what you're trying to do here you're trying to identify when the code does not meet certain conditions what are those conditions?
Rykorra
RykorraOP13mo ago
when the text entered is not NSEW
JakenVeina
JakenVeina13mo ago
how many conditions is that?
Rykorra
RykorraOP13mo ago
4
JakenVeina
JakenVeina13mo ago
write the code for each one
Angius
Angius13mo ago
Alternatively alternatively, pattern matching:
No description
JakenVeina
JakenVeina13mo ago
we already covered that not available in C# 7.3
Angius
Angius13mo ago
But chances are your teacher won't know wtf it is and will fail you Ah oof my condolences
Rykorra
RykorraOP13mo ago
I am sorry I am very lost about how to code this
Angius
Angius13mo ago
How do you write "shipZoneCode is not n"?
Rykorra
RykorraOP13mo ago
if (shipZoneCode != "n")
Angius
Angius13mo ago
Just the condition Without the if
JakenVeina
JakenVeina13mo ago
now how do you write "shipZoneCode is not s"?
Rykorra
RykorraOP13mo ago
shipZoneCode != "s"
Angius
Angius13mo ago
And now, how do you write a condition that both must be true?
JakenVeina
JakenVeina13mo ago
given that && combines conditions and you have just written 2 conditions
Rykorra
RykorraOP13mo ago
shipZoneCode != "n" && shipZoneCode != "s" && shipZoneCode != "e" && shipZoneCode != "w"
JakenVeina
JakenVeina13mo ago
🎉
Angius
Angius13mo ago
🎉
Rykorra
RykorraOP13mo ago
HAHAHAHAHAHAA how does the line end?
Rykorra
RykorraOP13mo ago
JakenVeina
JakenVeina13mo ago
I dunno, what do you want to do with that
Angius
Angius13mo ago
You don't need that last && Unless you want to chain another condition
Rykorra
RykorraOP13mo ago
it wasnt actually there that was just intellisense
JakenVeina
JakenVeina13mo ago
you have written a boolean expression that evaluates to true when shipZoneCode is none of the valid values you want why were you writing this expression in the first place?
Rykorra
RykorraOP13mo ago
to ensure that a valid zone code was entered
JakenVeina
JakenVeina13mo ago
why do you want to know that?
Rykorra
RykorraOP13mo ago
So that the correct price can be used in the cost
JakenVeina
JakenVeina13mo ago
when did we start talking about prices and costs? we were trying to display a message box in particular
if you were going to do it as a single if statement, what would that look like?
you were trying to write an if statement so take that expression and put it in an if statement
Rykorra
RykorraOP13mo ago
if (shipZoneCode != "n" && shipZoneCode != "s" && shipZoneCode != "e" && shipZoneCode != "w") { MessageBox.Show("Please Enter a Valid Zone Code."); } IT WORKSSSSSSSSSSSS 🎉 Okay so I am doing the math portion of this now should i make another help post or can we just do it in here?
Angius
Angius13mo ago
Here's fine I think
Rykorra
RykorraOP13mo ago
BlazeBin - ijsgxvdsaonh
A tool for sharing your source code with the world!
Rykorra
RykorraOP13mo ago
this is what i got so far seems like my costpp is incorrect
Angius
Angius13mo ago
Right, so, what's wrong with your code? Why do you think it's incorrect?
Rykorra
RykorraOP13mo ago
seems like it is multiplying 18 * 18
Angius
Angius13mo ago
Only if packWghtTB.Text is "18"
Rykorra
RykorraOP13mo ago
oh okay so Cost per pound is working fine and showing the correct value in the string my zone cost is dramatically higher though showing$702
Angius
Angius13mo ago
So, did you mean to do this?
costpp = (18 * costpp);
costN = (18 * costpp) + costN;
costpp = (18 * costpp);
costN = (18 * costpp) + costN;
Assuming user input here for costpp is 10, we're looking at
costpp = 18 * 10
costN = 18 * 18 * 10 + costN
costpp = 18 * 10
costN = 18 * 18 * 10 + costN
Rykorra
RykorraOP13mo ago
i need it to take that cost per pound which is 18 * weight entered in package weight tb + the zone cost
Angius
Angius13mo ago
Well that's not what you're doing, then To start with, you set costpp to your packWghtTB
costpp = decimal.Parse(packWghtTB.Text);
costpp = decimal.Parse(packWghtTB.Text);
Rykorra
RykorraOP13mo ago
should i make that a var? like i did the shipZoneCode
Angius
Angius13mo ago
Well, yeah, you probably do want to store the weight in a variable
Rykorra
RykorraOP13mo ago
okay done
Angius
Angius13mo ago
And now you can do your calculations
Rykorra
RykorraOP13mo ago
okay so what do i need to change about those calculations? get rid of the ()
Angius
Angius13mo ago
You can, sure Order of operations will ensure proper order anyway Definitely don't reassign the variables that are, from what I can see, supposed to be constant Like, costE is not supposed to change, is it?
Rykorra
RykorraOP13mo ago
no
Angius
Angius13mo ago
I'd even encourage you to declare those variables as actual constant fields
Rykorra
RykorraOP13mo ago
this is what I am getting now
Angius
Angius13mo ago
Well, yeah, constants cannot change We already established that we don't want to change those values, right? Same goes for costpp We don't want to reassign that value Rather, you want some new variable named, say total That total would be costpp * weight Then, depending on the zone selected, you would add the zone cost to it
Rykorra
RykorraOP13mo ago
? op i forgot to change costpp
Angius
Angius13mo ago
Why so many different costs? Or rather, so many different totals? There will be just one total, no? One result
Rykorra
RykorraOP13mo ago
it will display total cost per pound, Total zone cost , and total shipping cost capped at $100
Rykorra
RykorraOP13mo ago
this is what my form looks like
Angius
Angius13mo ago
Yeah, it will display totals Based on the selected zone Not totals for each zone So why have totals for each zone?
Rykorra
RykorraOP13mo ago
you are right seems wrong okay now my zone cost is showing correctly but my cost per pound is high
Rykorra
RykorraOP13mo ago
this is what i have now
Angius
Angius13mo ago
Yeah So, start with totalcost = 18 * costpp That's it Don't reassign to costpp Don't make multiple costs Just one
Angius
Angius13mo ago
Why start with totalcost = 0? decimal totalcost = 18 * costpp is enough Then, since the total cost has to be dependent on the zone...
Angius
Angius13mo ago
you have this part in your code
No description
Angius
Angius13mo ago
Perfect for changing stuff depending on the zone, is it not?
Rykorra
RykorraOP13mo ago
so like thise ?
Angius
Angius13mo ago
Yep Then, depending on the zone, add that cost If the zone is n, add costN to totalcost And so on
Rykorra
RykorraOP13mo ago
decimal in front right
Angius
Angius13mo ago
Why? You'll be reassigning to the totalcost, right? totalcost += costN for example Or totalcost = totalcost + costN if you're yet unfamiliar with +=
Rykorra
RykorraOP13mo ago
?
Angius
Angius13mo ago
Yeah, but you don't want to always do that, do you? Depending on the zone If zone is n you want to add costN If zone is s you want to add costS
MODiX
MODiX13mo ago
Angius
you have this part in your code
From Angius
React with ❌ to remove this embed.
Rykorra
RykorraOP13mo ago
I am very confused now haha
Angius
Angius13mo ago
Pseudocode:
cost = costpp * weight

if (zone is n)
cost = cost + costN
if (zone is s)
cost = cost + costS
// etc
cost = costpp * weight

if (zone is n)
cost = cost + costN
if (zone is s)
cost = cost + costS
// etc
Angius
Angius13mo ago
ye
Rykorra
RykorraOP13mo ago
so it is still not showing my cost per pound correctly
Angius
Angius13mo ago
How do you display it?
Angius
Angius13mo ago
Well, makes sense totalcost is cost per pund + zone cost Cost per pound is just costpp * weight While the zone cost... depends on the zone So, again, look into those ifs
Rykorra
RykorraOP13mo ago
can i get a hint?
Angius
Angius13mo ago
cost = costpp * weight

if (zone is n)
cost = cost + costN
zonecost.text = costN
if (zone is s)
cost = cost + costS
zonecost.text = costS
// etc
cost = costpp * weight

if (zone is n)
cost = cost + costN
zonecost.text = costN
if (zone is s)
cost = cost + costS
zonecost.text = costS
// etc
Angius
Angius13mo ago
👍
Rykorra
RykorraOP13mo ago
then delete this right
Angius
Angius13mo ago
Well, the last four lines from here, yes
Rykorra
RykorraOP13mo ago
this is what it is showing now I will be back in a little bit I apologize
Angius
Angius13mo ago
Sure Well I'm headed to bed now, so I'll be able to pick it up in some time Perhaps someone else will chip in
Omnissiah
Omnissiah13mo ago
it's over 400 msgs, maybe a recap? :/
M B V R K
M B V R K13mo ago
You could replace that textbox by a Combobox
Accord
Accord13mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server