SelectAll() public méthode

public SelectAll ( ) : void
Résultat void
 public static bool ParseInputH(TextBoxBase control, out uint value)
 {
     if (!uint.TryParse(control.Text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out value))
     {
         control.Focus();
         control.SelectAll();
         return false;
     }
     return true;
 }
 public static bool ParseInputD(TextBoxBase control, out ulong value)
 {
     if (!ulong.TryParse(control.Text, out value))
     {
         control.Focus();
         control.SelectAll();
         return false;
     }
     return true;
 }
Exemple #3
0
        public static bool SelectAll()
        {
            bool res = Execute(OnSelectAll);

            if (!res)
            {
                Control activeControl = Application.ActiveControl;
                if (activeControl == null)
                {
                    return(false);
                }

                System.Windows.Forms.TextBoxBase active = activeControl as System.Windows.Forms.TextBoxBase;
                res = active != null;
                if (res)
                {
                    active.SelectAll();
                }

                if (!res)
                {
                    System.Windows.Forms.WebBrowser webbrowser = activeControl as System.Windows.Forms.WebBrowser;
                    if (webbrowser != null)
                    {
                        WebBrowserHelper.ExecSelectAll(webbrowser);
                        ///TODO: don't work in unix
                        res = true;
                    }
                }

                if (!res)
                {
                    MethodInfo method = activeControl.GetType().GetMethod("SelectAll");
                    if (method != null)
                    {
                        Clipboard.FunctionWithoutReturn getMethod = (Clipboard.FunctionWithoutReturn)Delegate.CreateDelegate
                                                                        (typeof(Clipboard.FunctionWithoutReturn), activeControl, method);

                        getMethod();
                        res = true;
                    }
                }
            }
            return(res);
        }
Exemple #4
0
        private void ValidatingTextBox(TextBoxBase control, CancelEventArgs e)
        {
            if (!control.Enabled)
            {
                return;
            }

            if (control.Text.Length != 0)
            {
                return;
            }

            e.Cancel = true;
            control.SelectAll();
            errorProvider1.SetError(control, "Text box cannot be empty");
        }
 private static bool ParseInputD(TextBoxBase control, out ushort value)
 {
     if (!ushort.TryParse(control.Text, out value))
     {
         control.Focus();
         control.SelectAll();
         return false;
     }
     return true;
 }