Esempio n. 1
0
        ///<summery>
        ///初期文字列、説明文、入力最大長、許容文字リストを指定して、ダイアログを発生させる。
        ///ignoreがtrueの時、文字リストは無視対象となる。
        ///</summery>
        public static string ShowDialog(string defaulttext, string labelcaption, int maxlength, string checkcharlist, bool ignore)
        {
            dlgTextInput f = new dlgTextInput();

            if (defaulttext != null)
            {
                f.textBox1.Text = defaulttext;
            }
            if (maxlength > 0)
            {
                f.textBox1.MaxLength = maxlength;
            }
            if (labelcaption != null)
            {
                f.label1.Text = labelcaption;
            }
            f.ignorelist         = checkcharlist;
            f.ignoremode         = ignore;
            f.textBox1.KeyPress += new KeyPressEventHandler(f.textBox1_KeyPress);

            string ret = (f.ShowDialog() == DialogResult.OK) ? f.textBox1.Text : null;

            f.Dispose();
            return(ret);
        }
Esempio n. 2
0
        ///<summery>
        ///初期文字列、説明文、入力最大長を指定して、ダイアログを発生させる。
        ///maxlengthが0の場合、入力可能文字数はなし。
        ///</summery>
        public static string ShowDialog(string defaulttext, string labelcaption, int maxlength)
        {
            dlgTextInput f = new dlgTextInput();

            if (defaulttext != null)
            {
                f.textBox1.Text = defaulttext;
            }
            if (maxlength > 0)
            {
                f.textBox1.MaxLength = maxlength;
            }
            if (labelcaption != null)
            {
                f.label1.Text = labelcaption;
            }

            string ret = (f.ShowDialog() == DialogResult.OK) ? f.textBox1.Text : null;

            f.Dispose();
            return(ret);
        }