我感觉你是想做一个私有方法 private  void show() 
        { 
            MessageBox.Show(textBox1.Text); 
        } 

解决方案 »

  1.   

    私有方法能访问到text1.text吗?
      

  2.   

    你这样写方法算方法吗?namespace WindowsFormsApplication1 

        public partial class Form1 : Form 
        { 
            public Form1() 
            { 
                InitializeComponent(); 
            }         public static void show(ss) 
            { 
                MessageBox.Show(ss); 
            }         private void button1_Click(object sender, EventArgs e) 
            { 
              show(textBox1.Text); 
            } 
        } 
    }
      

  3.   

     改为:
            public void show() 
            { 
                MessageBox.Show(this.textBox1.Text); 
            }         private void button1_Click(object sender, EventArgs e) 
            { 
              this.show(); 
            } 
      

  4.   

     private void button1_Click(object sender, EventArgs e) 
            { 
              MessageBox.Show(this.textBox1.Text); 
              或
               ScriptManager.RegisterStartupScript(this, GetType(), "click", "window.alert('有异常:" + ex.Message + "');", true);
            } 
      

  5.   

    一个非 static 的方法在调用 static 的方法时不会调用对象。