分享

c#.net怎么实现弹出能输入的对话框

 天蓝云淡 2013-10-26

1. 输入框

 private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.textBox1.Text != "")
                {
                    SecFresh = Convert.ToInt32(this.textBox1.Text.Trim());
                    this.DialogResult = DialogResult.OK;
                }
            }
            catch { }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

 

2.  保存

            Form1 frmset = new Form1();
            frmset.SecFresh = sr;           
            if (frmset.ShowDialog(this)== DialogResult.OK)
            {
                try
                {
                    this.sr = frmset.SecFresh;
                    CLC.INIClass.IniPathSet(Application.StartupPath + "\\ConfigBJXX.ini");
                    CLC.INIClass.IniWriteValue("配置", "更新频率", sr.ToString());
                    this.timePeople.Interval = sr * 1000;
                    MessageBox.Show("更改成功", "系统提示");
                }
                catch { MessageBox.Show("更改失败", "系统提示"); }
            }

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约