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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:56:07+00:00 2026-05-26T16:56:07+00:00

Scenario: I have to check for user input (a string) that shouldn’t contain <.%?/

  • 0

Scenario:
I have to check for user input (a string) that shouldn’t contain <.%?/ symbols and if it does I remove them. I have 20 different places where I’ve to check it, actually, 20 different pages with each 20 different controls.

So I wrote a function like the following shortened example:

public string MyFunction (string userinput)
{
    return userinput.replace("<"," ");
}

Now if I want to call this function from within another function and there’s an error in this function’s try catch block I want it to write an error to a Label on the main page, without interrupting the second function.
Also i am thinking of implementing conditional statement function calls too.

  • 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-26T16:56:08+00:00Added an answer on May 26, 2026 at 4:56 pm

    Usually it’s best to let the calling function catch your error and to act upon it. Something like this (assuming C#, but your question wasn’t clear about that and didn’t have a working example):

    try {
        string resplacedString = yourReplaceFunction(userInput);
    } catch (MyException e) {
        Label1.Text = "An error occurred." + e.Description;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Imagine the following scenario. I have a checkbox that the user can check to
I have a scenario where I have to check whether user has already opened
Beginner level question Scenario: Have simple string cocantation tool, that I might expand later
I have a scenario where the user can select check boxes to select multiple
I have scenario, Page contains Check in date and Check out date for input.
I have a User Control that have a global resource with a string value
Scenario: You have an ASP.Net webpage that should display the next image in a
Scenario: I have a text file that has pipe (as in the | character)
Scenario: I have a console application that needs to access a network share with
Scenario: I have an application (C#) that expects a SQL database and login, which

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.