[英]Using System.Windows.Form not greyed
I've created a windows form called Grades and when I click the Submit button, it displays the "System.Windows.Form" onto the label and then the text I've entered onto the textbox. 我创建了一个名为“成绩”的Windows窗体,当我单击“提交”按钮时,它将在标签上显示“ System.Windows.Form”,然后将我输入的文本显示在文本框中。 For example, it displays "System.Windows.Form Tom".
例如,它显示“ System.Windows.Form Tom”。 Now I've been researching online and people say that I should add it as a reference.
现在我一直在进行在线研究,人们说我应该添加它作为参考。 I already did that and it seems as though that the using statement isn't greyed in like the other using statements.
我已经做到了,好像using语句没有像其他using语句一样呈灰色。 Please Help!
请帮忙!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Grades
{
public partial class frmGrades : Form
{
public frmGrades()
{
InitializeComponent();
}
private void btnSubmit_Click(object sender, EventArgs e)
{
lblDisplayStudentName.Text = Convert.ToString(txtBoxStudentName);
lblDisplayMessage.Text = Convert.ToString(txtBoxStudentGrade);
}
}
}
You need to get the text property of the textbox : 您需要获取文本框的text属性:
lblDisplayStudentName.Text = txtBoxStudentName.Text;
lblDisplayMessage.Text = txtBoxStudentGrade.Text;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.