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 9185359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:15:29+00:00 2026-06-17T19:15:29+00:00

How to check if a . has been input into a TextBox? is it

  • 0

How to check if a “.” has been input into a TextBox?

is it something like:

if (TextBox1.Text == ".")
{
    //Do something...
}

because when I do this, it seems to not check what is in the TextBox1 and just continue with the next line of code

Here is my code:

private void btnContinue1_Click(object sender, RoutedEventArgs e)
    {
        if (string.IsNullOrEmpty(HouseholdNoTextBox.Text))
        {
            textBlockError2.Visibility = Visibility.Collapsed;
            textBlockError1.Visibility = Visibility.Visible;                
        }
        if (HouseholdNoTextBox.Text.Length >= 3)
        {//checking to see if it has a length greater than 2
            textBlockError1.Visibility = Visibility.Collapsed; // collapse the first error box if it is visible
            textBlockError2.Visibility = Visibility.Visible; // and make visible the second
        }
        if (HouseholdNoTextBox.Text == ".")
        {
            textBlockError1.Visibility = Visibility.Visible;  
        }
        if (HouseholdNoTextBox.Text.Length <= 2 && HouseholdNoTextBox.Text.Length > 0)
        {
            textBlockError1.Visibility = Visibility.Collapsed;
            textBlockError2.Visibility = Visibility.Collapsed;
            NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
        }

I have also tried:

if (HouseholdNoTextBox.Text.Contains("."))
        {
            textBlockError1.Visibility = Visibility.Visible;  
        }

I have also tried:

private void btnContinue1_Click(object sender, RoutedEventArgs e)
    {
        string houseHoldNo = HouseholdNoTextBox.Text.ToString();

        if (string.IsNullOrEmpty(HouseholdNoTextBox.Text) || houseHoldNo.Contains(".")) // adding it here along with the first if statement
        {
            textBlockError2.Visibility = Visibility.Collapsed;
            textBlockError1.Visibility = Visibility.Visible;                
        }
    }

I have also tried:

private void btnContinue1_Click(object sender, RoutedEventArgs e)
{
string houseHoldNo = HouseholdNoTextBox.Text.ToString();

        if (string.IsNullOrEmpty(HouseholdNoTextBox.Text))
        {
            textBlockError2.Visibility = Visibility.Collapsed;
            textBlockError1.Visibility = Visibility.Visible;                
        }
        if (houseHoldNo.Contains("."))
        {
            textBlockError1.Visibility = Visibility.Visible;
        }
    }

and this above code does the same as the other.. it skips to the last if statement.

  • 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-06-17T19:15:31+00:00Added an answer on June 17, 2026 at 7:15 pm

    You can do this by checking for the “.”

    if(TextBox1.Text.Contains("."))
    {
    //Do Something
    }

    And then handle the event TextBox.TextChanged and place the above code in it.

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

Sidebar

Related Questions

I want to check whether the URL has been input into textarea or not.
How do I check if input has been entered? For example (python2) x =
I'm trying change an input mask for textbox when the the check box has
This question has been asked before, but not with this exact issue. I have
How can I check if a file has been created in the last x
I have a php script that check if the referrer has been cleared after
All I want to do is to check if the textfield has been changed.
Is there a way to check if the form that has been loaded with
I would like to make a JComboBox that has check boxes for items instead
I'm trying to use JQuery to check upon submission if a field input has

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.