包含textbox.text的消息框

时间:2011-09-06 20:19:41

标签: c# winforms

我想在消息框中显示文本框文本,不断收到错误。

MessageBox.Show(textBox1.text + "Saved As PDF");

,错误是

Error   1   'System.Windows.Forms.TextBox' does not contain a definition for
   'text' and no extension method 'text' accepting a first argument of type
   'System.Windows.Forms.TextBox' could be found (are you missing a using 
   directive or an assembly reference?) 
   R:\Engineer\Russell Saari\CONFIGURATOR MODELS\MLD028 Userform (C# Coding)\WindowsFormsApplication2\MLD028D Actuator Form Complete.cs 118 38 WindowsFormsApplication

2 个答案:

答案 0 :(得分:9)

属性通常以大写字母开头。

尝试

MessageBox.Show(textBox1.Text + "Saved As PDF");

(请注意T中的.Text是大写的)

答案 1 :(得分:4)

你没有说出错误是什么,但是要开始,让我们编译你的代码。 Text应该大写。

MessageBox.Show(textBox1.Text + "Saved As PDF");