问题如题,messagebox里面可以显示文本框吗 ???

解决方案 »

  1.   

    那是  托管调用的API ,都是定义好的, 你自己写一个 form 吧 !效果一样的!
      

  2.   

    不行,你可以自己做個form來實現這個功能。
      

  3.   

    自己写呀!!给新窗口加个GET/SET方法就可以完成你需要的input了!
      

  4.   

    类似VB里的inputBox吧?C#没有这样的,可以自己用个窗体代替,或者写个用户控件,也可以找个第三方控件....
      

  5.   

    你们看看messagebox里有没有写文本筐的方法.和属性填充..
      

  6.   

    零时做了个!!做个页面加一个TEXTBOX就可以了!!主要方法!form2.cs
    ------------------------>>       
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;namespace prjCx
    {
        public partial class Form2 : Form
        {        
            private string sInputMess = "";        /// <summary>
            /// 进行传值的属性方法
            /// </summary>
            public string inputMess
            {
                get { return sInputMess; }
                set { this.sInputMess = value; }
            }        public Form2()
            {
                InitializeComponent();
            }        /// <summary>
            /// 确定按钮
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private void button1_Click(object sender, EventArgs e)
            {
                this.inputMess = this.textBox1.Text.Trim();
                this.DialogResult = DialogResult.OK;
                this.Close();
            }        /// <summary>
            /// 取消按钮
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private void button2_Click(object sender, EventArgs e)
            {
                this.Close();
            }
        }
    }   
    Form2.Designer.cs
    ------------------------->>   
    namespace prjCx
    {
        partial class Form2
        {
            /// <summary>
            /// 必需的设计器变量。
            /// </summary>
            private System.ComponentModel.IContainer components = null;        /// <summary>
            /// 清理所有正在使用的资源。
            /// </summary>
            /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
            protected override void Dispose(bool disposing)
            {
                if (disposing && (components != null))
                {
                    components.Dispose();
                }
                base.Dispose(disposing);
            }        #region Windows 窗体设计器生成的代码        /// <summary>
            /// 设计器支持所需的方法 - 不要
            /// 使用代码编辑器修改此方法的内容。
            /// </summary>
            private void InitializeComponent()
            {
                this.label1 = new System.Windows.Forms.Label();
                this.textBox1 = new System.Windows.Forms.TextBox();
                this.button1 = new System.Windows.Forms.Button();
                this.button2 = new System.Windows.Forms.Button();
                this.SuspendLayout();
                // 
                // label1
                // 
                this.label1.AutoSize = true;
                this.label1.Location = new System.Drawing.Point(12, 18);
                this.label1.Name = "label1";
                this.label1.Size = new System.Drawing.Size(77, 12);
                this.label1.TabIndex = 0;
                this.label1.Text = "请输入数值:";
                // 
                // textBox1
                // 
                this.textBox1.Location = new System.Drawing.Point(14, 43);
                this.textBox1.Name = "textBox1";
                this.textBox1.Size = new System.Drawing.Size(276, 21);
                this.textBox1.TabIndex = 1;
                // 
                // button1
                // 
                this.button1.Location = new System.Drawing.Point(91, 79);
                this.button1.Name = "button1";
                this.button1.Size = new System.Drawing.Size(64, 24);
                this.button1.TabIndex = 2;
                this.button1.Text = "确定";
                this.button1.UseVisualStyleBackColor = true;
                this.button1.Click += new System.EventHandler(this.button1_Click);
                // 
                // button2
                // 
                this.button2.Location = new System.Drawing.Point(161, 79);
                this.button2.Name = "button2";
                this.button2.Size = new System.Drawing.Size(59, 24);
                this.button2.TabIndex = 3;
                this.button2.Text = "取消";
                this.button2.UseVisualStyleBackColor = true;
                this.button2.Click += new System.EventHandler(this.button2_Click);
                // 
                // Form2
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(322, 124);
                this.Controls.Add(this.button2);
                this.Controls.Add(this.button1);
                this.Controls.Add(this.textBox1);
                this.Controls.Add(this.label1);
                this.MaximizeBox = false;
                this.MinimizeBox = false;
                this.Name = "Form2";
                this.Text = "输入对话框";
                this.ResumeLayout(false);
                this.PerformLayout();        }        #endregion        private System.Windows.Forms.Label label1;
            private System.Windows.Forms.TextBox textBox1;
            private System.Windows.Forms.Button button1;
            private System.Windows.Forms.Button button2;
        }
    }
      

  7.   

    晕!!这相当于inputbox!!
    在用的时候只需要:
    string sInput="";
    form2 frm2=new form2();
    if (frm2.ShowDialog()==DialogResult.OK)
    {
         sInput=frm2.inputMess;  //把form2输入的值传递给sInput  
    }