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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:45:54+00:00 2026-06-16T02:45:54+00:00

I have about 100 textboxes on a page, and each textbox has its own

  • 0

I have about 100 textboxes on a page, and each textbox has its own corresponding value in an array, each textbox has a method which is invoked when the value in the textbox is changed, and updates the corresponding elements of the array, to reflect that value it has been changed to. (In theory)

However, is there a way that you can adjust the below method, so that rather than writing it out 100 times, with a changing name “_8_8_TextChanged”, and changing the values that it changes manually, and doing it so that 1 method is called by all textboxes, and the method recognises which textbox called it, and updates the relevant elements in the array?

The Method is defined below and features on the “Solver.xaml.cs” page.

private void _8_8_TextChanged(object sender, TextChangedEventArgs e)
    {
        int number = int.Parse(_8_8.Text);
        if ((number >= 1) && (number <= 9))
        {
            for (int i = 0; i <= 8; i++)
            {
                if (i == (number - 1))
                {
                    content[8, 8, i] = true;
                }
                else
                {
                    content[8, 8, i] = false;
                }
            }
        }
    }

The XAML textbox itself is defined below and features on the “Solver.xaml” page, with its styling elements removed for simplicity.

<TextBox x:Name="_8_8" TextChanged="_8_8_TextChanged"/>
  • 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-16T02:45:55+00:00Added an answer on June 16, 2026 at 2:45 am

    I really hope you have a good reason for using that many text boxes. In any case you can use the same event handler for all of your TextChange events, as follows.

    All textboxes would be set up to use the same handler:

    <TextBox x:Name="_8_8" TextChanged="_x_y_TextChanged"/>
    <TextBox x:Name="_8_9" TextChanged="_x_y_TextChanged"/>
    

    You can then update your array based on the sending text box:

    private void _x_y_TextChanged(object sender, TextChangedEventArgs e)
        {
            TextBox tb = (TextBox)sender;
    
            // use the Name of the textbox to determine x, y value
            string[] tmp_x_y = tb.Name.Split("_");
            // you may have to adjust these indices based on how Split actually
            // does its work.
            int x = int.Parse(tmp_x_y[0]);
            int y = int.Parse(tmp_x_y[1]);
    
            int number = int.Parse(tb.Text);
            if ((number >= 1) && (number <= 9))
            {
                for (int i = 0; i <= 8; i++)
                {
                    if (i == (number - 1))
                    {
                        content[x, y, i] = true;
                    }
                    else
                    {
                        content[x, y, i] = false;
                    }
                }
            }
        }
    

    I didn’t actually compile the code above, but it should give you a good starting point.

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

Sidebar

Related Questions

I have a mutable array that has about 100 objects in it and each
I have about 100 sites built in a cms, each with its own database.
I have about 100 pages, every of which has 10-100 images attached. The path
I have about 100 error marker 50 each message. But not every Entity has
I have forms with about 100 input fields each (textbox, textarea, radio, checkbox, file,
I have about 100 Word documents which include transliteration of foreign names. The author
I have a slickgrid, with about 100 rows. Its data is refreshed in 5
Preliminary : I have an application which maintains a thread pool of about 100
I have about 100 TextBoxes in a Form. I need to validate them if
I have about 100 data points which mostly satisfying a certain function (but some

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.