验证输入的数据,然后将其应用于BindingSource底层源

时间:2012-07-16 07:41:07

标签: c# validation bindingsource

BindingSource BS = new BindingSource();
public Cource()
{
    InitializeComponent();
}

private void Cource_Load(object sender, EventArgs e)
{
    DataSet ds = new DataAccess.newCourcesDAC().GetAllTeachers();
    BS.DataSource = ds;
    BS.DataMember = "tblCourses";
    dataGridView1.DataSource = BS;
    txtCourseID.DataBindings.Add("Text", BS, "CourseID");
    txtCourseName.DataBindings.Add("Text", BS, "CourseName");
    txtPrequest.DataBindings.Add("Text", BS, "Prequest");
    txtCourseContent.DataBindings.Add("Text", BS, "CourseContent");
}

private void btnAdd_Click(object sender, EventArgs e)
{
    BS.AddNew();
}

我有一个数据源,其数据库名为“tblCourses”,有4列。 我使用BindingSource管理货币beetwen datagridView和4文本框。 我使用bindingSource的addNew metode向dataTable添加新行。 如何验证输入的数据是否可以将其应用于BindingSource底层源?

0 个答案:

没有答案