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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:35:43+00:00 2026-05-27T10:35:43+00:00

I am trying to be able to paste (mouse or keyboard shortcut) a 12

  • 0

I am trying to be able to paste (mouse or keyboard shortcut) a 12 digit number (IP address, but no periods between) into 4 fields. Each has maximum length of 3.

I am trying to do this by using TextChange, text box, property. I was trying to use Substring but it doesn’t each octet work.

    public PingIPRange()
    {
        InitializeComponent();

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

    private void NextField(object sender, EventArgs e)
    {
        if (txtF1.TextLength == 3)
        {
            txtF2.Focus();
            txtF1.Text = txtF1.Text.Substring(0, 3);
            txtF2.Text = txtF1.Text.Substring(3, 30);
        }
        if (txtF2.TextLength == 3)
        {
            txtF3.Text = txtF2.Text.Substring(3, 27);
            txtF3.Focus(); 
        }
        if (txtF3.TextLength == 3)
        {
            txtF4.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-27T10:35:44+00:00Added an answer on May 27, 2026 at 10:35 am

    Try putting this code in NextField method. And hookup only to txtF1 textbox textchange event.

    TextBox txt = (TextBox) sender; 
    var s1 = txt.Text.Split('.');
    
    if(s1.Length==4)
    {
        txtF1.Text = s1[0];
        txtF2.Text = s1[1];
        txtF3.Text = s1[2];
        txtF4.Text = s1[3];
    } 
    

    UPDATE: As you have updated the question that there will not be any dot symbol you can split string like this

    var s1=Enumrable
        .Range(0,4)
        .Select(i => txt.Text.Substring(i * 3, 3))
        .ToArray();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to compress any given string to a shorter version, copy paste-able compressed
I am trying to be able to detect when a mouse is held down
Im trying to run a shell with cakephp but I'm not able to do
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 import png, which I believe is from
I'm trying to be able to have a global exception capture where I can
Im trying to create a hive provider that would be able to work towards
Am trying to create a java project which can able to send push notification
I'm trying to create a complex custom NSControl that must be able to send

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.