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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:08:03+00:00 2026-05-28T06:08:03+00:00

For example if in a textbox that is full of many different part numbers

  • 0

For example if in a textbox that is full of many different part numbers from a material list for computer parts, I only want one type of cat5 cable at any given time, and if two different types are seen, to warn the user. The cat5 cable part numbers could be: cat5PART#1, cat5PART#2, and cat5PART#3. So if only one cat5 part number is seen no worries, but as soon as two different types or more are seen, to warn.

I could easily write it out manually three different times for each variation, but on a larger list of parts, it would take longer and risk mistakes. Plus I’d just love to know how programmers handle this type of function. I also don’t know what it is called, so I’m not sure how to google for it.

An example of my code which obviously doesn’t work because it would only warn if all three parts were detected not just if two were detected is below. I assume I’d use some variation of & and |, or maybe it’s something completely different?

Basically I don’t want to have to write out on a larger scale

if contains part 1 and part 2 …
if contains part 1 and part 3 …
if contains part 2 and part 3 …

if ((textBox2.Text.Contains("PART#1"))
  && (textBox2.Text.Contains("PART#2"))
  && (textBox2.Text.Contains("PART#3")))
{
    MessageBox.Show("2 types of cat5 part numbers seen at the same time");
}
  • 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-28T06:08:04+00:00Added an answer on May 28, 2026 at 6:08 am

    You can try this:

    string[] parts = new [] {"PART#1", "PART#2", "PART#3"};
    int count = parts.Count(s => textBox2.Text.Contains(s));
    if (count >= 2) ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make the textbox allow only three digits and three decimals.For example
i just want to get a text from textbox that is betwen two dots
I'm implementing a textbox filter on a list based on Josh Smith's example at
How can I restrict TextBox to accept only capital letters, or for example digits,
I am wondering how I can get the value from an asp.net textbox that
I have a textbox that I want to validate, but when I validate it
I have a list of of databound items. I have a textbox that filters
I'm using a RegularExpressionValidator in ASP.NET on a textbox that requires 10 numbers as
For example, if there was a TextBox that contained this text: The quick brown
Rep steps: create example .NET form application put a TextBox on the form wire

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.