Calculator program
Format error appears if I click plus button at first in my calculator program .How to solve this problem?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sukesh MarlaRank #461 · 5.4K reputationPosted Jan 31, 2013, 7:53 PM EST
DIGVIJAY SINGH40 reputationPosted Feb 1, 2013, 2:25 AM EST
Convert.ToDecimal(txtbox1.text);
string convert to Decimal or interger
Rajeev KumarRank #1,334 · 1.3K reputationPosted Jul 11, 2023, 2:23 AM EDT
public ActionResult Calculate() { return View(); }After that right click and add a view page
and now we are going for a method in controller
[HttpPost] public ActionResult Calculat(string firstNumber, string secondNumber, string Cal) { int a = Convert.ToInt32(firstNumber); int b = Convert.ToInt32(secondNumber); int c = 0; switch (Cal) { case "Add": c = a + b; break; case "Sub": c = a - b; break; case "Mul": c = a * b; break; case "Div": c = a / b; break; } ViewBag.Result = c; return View(); }