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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:58:48+00:00 2026-06-14T20:58:48+00:00

I have a Windows Form with two textboxes and two buttons. The textboxes are

  • 0

I have a Windows Form with two textboxes and two buttons. The textboxes are named txtVisited and txtAnswer. The buttons are Visited? and Exit. I want to input a city into the first textbox and have it check the array for a match. If there is a match, I want to display the text that it has been visited and it’s position in the array. If it does not find a match, I want it to display the text “not visited.” I have copied all the code I have so far. Any help would be much appreciated. I’m still really new to c# so I may or may not understand your answer. So bear with me. Sorry in advance.

    namespace Array
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnVisited_Click(object sender, EventArgs e)
        {
            string[] CityName = {"Columbus", "Bloomington", "Indianapolis",
                "Fort Wayne", "Greensburg", "Gary", "Chicago", "Atlanta", "Las Vegas"};
            bool visitedbool;
            int Subscript;
            string QueryCity;
            QueryCity = txtState.Text.ToUpper();
            int Subscript =0;
            visitedbool = false;

            while (visitedbool = true)

            if (CityName(intsubscript).ToUpper= QueryCity)
            {
                visitedbool = true
            }

            else
            { 
                Subscript =  Subscript +1
            }
        }
    }
}
  • 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-14T20:58:50+00:00Added an answer on June 14, 2026 at 8:58 pm

    So I don’t know what happened to the other guy’s answer, but he helped me through this process. I just want to extend my deepest gratitude for his effort. He never got impatient with me and I’m a tard when it comes to c#. He gave me the code to get it working. I just had to add the code for the text boxes. `namespace Project
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    
        private void btnVisited_Click(object sender, EventArgs e)
        {
            {
                string[] CityName = {"Columbus", "Bloomington", "Indianapolis",
                "Fort Wayne", "Greensburg", "Gary", "Chicago", "Atlanta", "Las Vegas"};
                string queryCity = txtState.Text;
                int position;
                string city;
    
                if (CityName.Contains(queryCity))
                {
                    position = Array.IndexOf(CityName, queryCity);
                    city = txtState.Text;
                    txtAnswer.Text = "You have visited" +" " + queryCity + " " + position;
                }
                else
                {
                    txtAnswer.Text = "You have not visited this city yet.";
                }
            }`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background I have a Windows Form with the following items: ComboBox TextBox Two Buttons
I currently have a windows form application composed of a textbox and two buttons
I have a windows form that has two DataGridViews (DGVs) that will hold 25,000+
I have created two forms in my Windows Application. One Form acts as a
i have a windows form that contains a bunch of textboxes. I need a
In my windows form i have two combobox and one text box when a
My small windows form application has two radio buttons, and initially neither is checked.
I have a(n) (MDI) Windows Form application. It contains two forms. One form (Measured
I have a Windows Form and a class with two simple methods that run
I am developing Windows Form Application using Microsoft Visual C# 2010 I have two

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.