c# - Creating a very simply Shipping Calculator -


so have create simple sales calculator, have got gui made far , here code far.

        private void button1_click(object sender, eventargs e)     {         //to hold data         double weight;         double zone;         double weightcost;          //validate data         if (double.tryparse(textbox_weight.text, out weight) &&             double.tryparse(textbox_zone.text, out zone))         {          } 

so far @ moment want assume shipping price $5.25. zones, need program recognize whether or not zone x, y, or z entered, if 1 of not entered need sort of error message display. zone x, $14.75 zone cost, y $16.15 , zone z $50.95. want display information in 3 labels, being label_weightcost label_zonecost , label_totalcost, though don't quite know how display information labels after doing calculations. calculations quite easy, being weightcost = weight * 5.25 zonecost = zone ( need know how have program recognize whether or not zone x, y or z , equal $14.75 $16.15 or $50.95 ) totalcost = weightedcost + zonecost

we need have program display error if rather number displayed in textbox's though can that.

for zones, thinking, if else if kind of deal?

if { //i'll add doubles double y = 16.15; zone = y label_zone.text = zone.tostring("n1"); } 

instead of user entering in zone information textbox, should make them select zone or select combobox. give them zones can enter, , can add cost based on combobox.selecteditem done. can display messagebox.show() if selectedindex < 0, means didn't enter in.

after display values label need use label name, followed text label1.text = zone;


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -