Exemplo n.º 1
0
 private void Ip2_KeyPress(object sender, KeyPressEventArgs e)
 {
     if ((Keys)e.KeyChar == Keys.Tab && Ip2.Text.Length > 0 && Ip2.SelectionLength == 0)
     {
         Ip3.Focus();
         Ip3.Select(0, Ip3.Text.Length);
     }
 }
Exemplo n.º 2
0
        private void Ip2_TextChanged(object sender, EventArgs e)
        {
            if (Ip2.Text.Length == 3 && Ip2.Text.Length > 0 && Ip2.SelectionLength == 0)
            {
                Ip3.Focus();
                Ip3.Select(0, Ip3.Text.Length);
            }

            if (Ip2.Text.LastIndexOf('.') != -1)
            {
                Ip2.Text.Replace('.', ' ').Trim();
                Ip3.Focus();
                Ip3.Select(0, Ip3.Text.Length);
            }
        }
Exemplo n.º 3
0
 private void Ip2_TextChanged(object sender, EventArgs e)
 {
     if (Ip2.Text.Length == 3 && Ip2.Text.Length > 0 && Ip2.SelectionLength == 0)
     {
         if (Convert.ToInt32(Ip2.Text) > 255)
         {
             Ip2.Text = "255";
         }
         else
         {
             Ip3.Focus();
             Ip3.Select(0, Ip3.Text.Length);
         }
     }
 }
Exemplo n.º 4
0
        private void Ip2_KeyPress(object sender, KeyPressEventArgs e)
        {
            string inputStr = e.KeyChar.ToString();

            if (e.KeyChar != (char)ConsoleKey.Backspace)
            {
                if (e.KeyChar == 46 && Ip2.Text.Length > 0 && Ip2.SelectionLength == 0)
                {
                    Ip3.Focus();
                    Ip3.Select(0, Ip3.Text.Length);
                }
                if (CheckInput(inputStr) == false)
                {
                    e.Handled = true;
                }
            }

            base.OnKeyPress(e);
        }
Exemplo n.º 5
0
        private void Ip_OnPressBackspace(int index)
        {
            switch (index)
            {
            case 4:
                Ip3.Focus();
                Ip3.SelectionStart = Ip3.Text.Length;
                break;

            case 3:
                Ip2.Focus();
                Ip2.SelectionStart = Ip2.Text.Length;
                break;

            case 2:
                Ip1.Focus();
                Ip1.SelectionStart = Ip1.Text.Length;
                break;

            default:
                break;
            }
        }
Exemplo n.º 6
0
 public string GetIpAsString()
 {
     return(Ip1.ToString() + '.' + Ip2.ToString() + '.' + Ip3.ToString() + '.' + Ip4.ToString());
 }