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

  • SEARCH
  • Home
  • 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 6049383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:34:15+00:00 2026-05-23T07:34:15+00:00

So I have users inputting numbers into multiple text boxes and I need to

  • 0

So I have users inputting numbers into multiple text boxes and I need to check that they are not null and convert them to decimal. Is there a simpler way to do this than a separate IF for each textbox?

if (txtBoxAuto1.Text != null)
{

    String varStrTxtBox1 = txtBoxAuto1.Text;
    decimal varTxtBox1 = Decimal.Parse(varStrTxtBox1);


}

I tried putting an “and” after the first textbox and it didn’t seem to like it.

  • 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-23T07:34:16+00:00Added an answer on May 23, 2026 at 7:34 am

    When I did such stuff, I added the Textboxes into a list to loop thought them.
    Or if you have all Textboxes in a panel you can loop thought them just like

    foreach(Control c in this.panel1.Controls)
            {
                if (c.GetType() == typeof(TextBox) && c.Text != String.Empty)
                {
                    decimal myValue = Convert.ToDecimal(c.Text);
                }
            }
    

    Or did I miss the point?

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

Sidebar

Related Questions

We frequently have users that create multiple accounts and then end up storing the
If yo have multiple users on your website on the same page and they
Hi I have a MVC site and will have users inputting text to be
Our users have created MS-Excel spreadsheets which over time have evolved into fairly complex
I have a custom tag that extends Spring's InputTag to display numbers in the
I have users upload files into a fake directory structure using a database. I
I have users who are using secure-wave security. Evidently it is some sort of
Here's the scenario: We have users login on a secure connection. Could an unathorized
What is the best way to determine available bandwidth in .NET? We have users
In a PHP application I am writing, I would like to have users enter

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.