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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:31:42+00:00 2026-05-21T20:31:42+00:00

Currently developing an application for Windows Phone that makes use of the bing maps

  • 0

Currently developing an application for Windows Phone that makes use of the bing maps geocode service. I have a search box where users can type in a location and then this is sent to bing maps which returns a geocoordinate.

I have however, run into an issue with the search box. When I enter random letters no results are found and I have implemented code so the user is informed that there are no destinations found. The problem is though that if for whatever the reason the user decides to write some symbols eg: &$%£” this crashes the application when bing maps returns some data.

How would I go about validating the textbox entry so that it checks to see if there are any symbols in the string and then sends this off to the service if there are not?

Any help is much appreciated!

  • 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-21T20:31:42+00:00Added an answer on May 21, 2026 at 8:31 pm

    The best option is to prevent the user from entering invalid characters. This can be done by using Regular Expressions within the TextChanged event. You can either go with a permissive or restrictive model.

    Be sure to add the necessary using statement:

    using System.Text.RegularExpressions;
    

    In the permissive model, you allow all characters except for ones you have specifically forbidden:

    private Regex rxForbidden = new Regex(@"[&$%£]", RegexOptions.IgnoreCase);
    private void txtInput_TextChanged(object sender, TextChangedEventArgs e)
    {
        txtInput.Text = rxForbidden.Replace(txtInput.Text, "");
        txtInput.SelectionStart = txtInput.Text.Length;
    }
    

    In the restrictive model, you only allow specific characters:

    private Regex rxForbidden = new Regex(@"[^0-9a-z]", RegexOptions.IgnoreCase);
    private void txtInput_TextChanged(object sender, TextChangedEventArgs e)
    {
        txtInput.Text = rxForbidden.Replace(txtInput.Text, "");
        txtInput.SelectionStart = txtInput.Text.Length;
    }
    

    Generally the restrictive model will be easier to maintain (you won’t have to go back and keep adding additional forbidden symbols as you discover them), but it really depends on your application. In either case, any uses of forbidden symbols will be ignored completely as if the user didn’t hit that key.

    As a side note, your textbox should have it’s InputScope set to Maps.

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

Sidebar

Related Questions

we're currently developing an application that makes extensive use of popup windows(*) and have
I am developing a Windows Phone 7 Silverlight application that currently displays a map
I'm currently developing a application where I will have multiple windows open using C#
I'm developing my first Windows Phone 7 application and I have to add an
I'm developing a twitter application for Windows Phone 7 and have been doing some
I'm currently developing an application that is comprised of five separate executables that communicate
I am currently developing a Rails application using a database that was designed before
I'm currently developing a PHP application that's using an Access database as a backend.
The application my team is currently developing has a DLL that is used to
In the small application that I'm currently developing for a customer I need to

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.