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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:52:13+00:00 2026-05-27T11:52:13+00:00

So what I am trying to do is to be able to continuously type

  • 0

So what I am trying to do is to be able to continuously type into all of 10 text boxes. I start from the first one, then after 3 characters were typed change focus to next and after 3 characters were typed focus on the next.

I have done that part, but what if there is text already in second text box? I have tries Clear() but it creates a bug for which won’t let me type more than 1 character.

So when all text boxes are filled with junk data, so when I start typing at first text box 123 then moves to second text box 456 third 789 ect. but while next field is cleared first.

I am trying to work with this:

    public PingIPRange()
    {
        InitializeComponent();

        txtF1.TextChanged += new EventHandler(NextField);
        txtF2.TextChanged += new EventHandler(NextField);
        txtF3.TextChanged += new EventHandler(NextField);
        txtF4.TextChanged += new EventHandler(NextField);

        txtT1.TextChanged += new EventHandler(NextField);
        txtT2.TextChanged += new EventHandler(NextField);
        txtT3.TextChanged += new EventHandler(NextField);
        txtT4.TextChanged += new EventHandler(NextField);

        txtInterval.TextChanged += new EventHandler(NextField);
        txtRepeat.TextChanged += new EventHandler(NextField);
    }

    private void NextField(object sender, EventArgs e)
    {
        if (txtF1.TextLength == 3)
        {
            txtF2.Focus();              
        }
        if (txtF2.TextLength == 3)
        {
            txtF3.Focus();
        }
        if (txtF3.TextLength == 3)
        {
            txtF4.Focus();
        }
        if (txtF4.TextLength == 3)
        {
            txtT1.Focus();
        }
        if (txtT1.TextLength == 3)
        {
            txtT2.Focus();
        }
        if (txtT2.TextLength == 3)
        {
            txtT3.Focus();
        }
        if (txtT3.TextLength == 3)
        {
            txtT4.Focus();
        }
        if (txtT4.TextLength == 3)
        {
            txtInterval.Focus();
        }
        if (txtInterval.TextLength == 3)
        {
            txtRepeat.Focus();
        }
        if (txtRepeat.TextLength == 3)
        {
            btnPing.Focus();
        }
    }
}
  • 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-27T11:52:14+00:00Added an answer on May 27, 2026 at 11:52 am

    Add the Enter event for the TextBoxes, and do a SelectAll on the text.

    txtF2.Enter += SelectTextOnEnter;
    txtF3.Enter += SelectTextOnEnter;
    // etc.
    
    
    private void SelectTextOnEnter(object sender, EventArgs e) { 
      ((TextBox)sender).SelectAll();
    }
    

    Also, your NextField method doesn’t quite do what you think it does. Make sure your controls TabIndex values are in the correct order, then try changing your code to this:

    private void NextField(object sender, EventArgs e) {
      if (((TextBox)sender).Text.Length == 3)
        this.SelectNextControl((Control)sender, true, true, false, false);
    }
    

    It will choose the next control based on the tab order of the form.

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

Sidebar

Related Questions

I am trying to rotate an image of wheel continuously. I was able to
I am trying to be able to import png, which I believe is from
On SQL Server I am trying to be able to select * records from
I'm trying to build an usercontrol wich is able to take elements from XAML
I am facing a small issue which i am not able after trying so
I am trying to play continuous stream using android mediaplayer.but am not able to
I'm trying to be able to place the error message when using jQuery validation
I'm trying to be able to run my mobile app on my android phone,
I am trying to be able to detect when a mouse is held down
I'm trying to be able to have a global exception capture where I can

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.