textBox1_TextChanged还需要定义?
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 WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (this.dataGridView1.DataSource == null)
{
this.textBox1.Text = "没有绑定数据源";
}
else
{
this.textBox1.Text = "绑定了数据源";
}
}
}
}
编译不能通过,显示错误信息:
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 CS1061 “Form1”未包含“textBox1_TextChanged”的定义,并且找不到可接受第一个“Form1”类型参数的可访问扩展方法“textBox1_TextChanged”(是否缺少 using 指令或程序集引用?) WindowsFormsApp1 F:\C#练习\练习2\WindowsFormsApp1\WindowsFormsApp1\Form1.Designer.cs 51 活动的