Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 844561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:18:11+00:00 2026-05-15T06:18:11+00:00

Working on some .aspx.cs code and decided I would forget how to turn a

  • 0

Working on some .aspx.cs code and decided I would forget how to turn a textbox value into a useable integer or decimal.
Be warned I’m pretty new to .asp. Wish I could say the same for c sharp.
So the value going into my textbox (strawberryp_textbox) is “1” which I presume I can access with the .text property. Which I then parse into a int. The Error reads Format Exception was unhandled by user code.

My other question is can I do operations on a session variable?

protected void submit_order_button_Click(object sender, EventArgs e)
{
    int strawberryp;
    int strawberrys;

    decimal money1 = decimal.Parse(moneybox1.Text);
    decimal money2 = decimal.Parse(moneybox2.Text);
    decimal money3 = decimal.Parse(moneybox3.Text);
    decimal money4 = decimal.Parse(moneybox4.Text);
    decimal money5 = decimal.Parse(moneybox5.Text);

    strawberryp = int.Parse(strawberryp_Textbox.Text);    //THE PROBLEM RIGHT HERE!
    strawberrys = int.Parse(strawberrys_Textbox.Text); // Needs fixed
    int strawberryc = int.Parse(strawberryc_Textbox.Text); //fix
    int berryp = int.Parse(berryp_Textbox.Text); //fix
    int raspberryp = int.Parse(raspberryp_Textbox.Text); /fix
    decimal subtotal = (money1 * strawberryp) + (money2 * strawberrys) + (money3 * strawberryc) + (money4 * berryp) + (money5 * raspberryp); //check to see if you can multiply decimal and int to get a deciaml!!


    Session["passmysubtotal"] = subtotal; //TextBox2.Text;

    (strawberryp_Textbox.Text);//TextBox4.Text;

    add_my_order_button.Enabled = true;
    add_my_order_button.Visible = true;
    submit_order_button.Enabled = false;
    submit_order_button.Visible = false;
    strawberryp_Textbox.ReadOnly = false;
    strawberrys_Textbox.ReadOnly = false;
    strawberryc_Textbox.ReadOnly = false;
    berryp_Textbox.ReadOnly = false;
    raspberryp_Textbox.ReadOnly = false;
    Response.Redirect("reciept.aspx");
}

Thanks for the help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T06:18:11+00:00Added an answer on May 15, 2026 at 6:18 am

    Post the results of putting a Console.WriteLine(strawberryp_Textbox.Text); just before the line in your code that has the “THE PROBLEM…” comment. If you run the app under the Visual Studio web server (usually by debugging – hit F5), the output should show up in the Output pane in Visual Studio. That might help verify that only the single character ‘1’ is in the Text property of that textbox.

    Also, a best practice is to use TryParse instead of Parse so you can more carefully control responding to errors in the expected values.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 506k
  • Answers 506k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You could use attributes : using System.ComponentModel; public enum Tile… May 16, 2026 at 3:44 pm
  • Editorial Team
    Editorial Team added an answer So roughly a year on from the OP's question, PyDev… May 16, 2026 at 3:44 pm
  • Editorial Team
    Editorial Team added an answer You are going to have a very hard time reproducing… May 16, 2026 at 3:44 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have some working code that uses IImgCtx to load images, but I can't
In my SharePoint app, I deploy some aspx pages to the [12 Hive]\TEMPLATE\LAYOUTS folder.
I have a user control which uses objects as inner properties (some code is
I am working on some documentation and need to reference the .Net Framework Class
I have a designer working at the ASPX level. He doesn't do C#, doesn't
I have just redeveloped some vbscript in to c#.net and i have it working
The code goes something like this: protected bool IsOKToSend() { bool IsOK = true;
Recently I posted a question about the html helper dropdownlist and got it working
I am using Tortoise SVN. I had checked in a crapload of code recently
I have a JSON data store used for a combobox selection which is working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.