读书人

初学者!用BondingContext不能显示下一

发布时间: 2012-05-11 12:55:37 作者: rapoo

菜鸟求助!!用BondingContext不能显示下一笔资料
我用四个TextBox绑定了四个字段,用来显示TABLE中的资料,新增了四个BUTTON,为别为第一笔,前一笔,下一笔,最后一笔,想用这四人按钮来查看Table中的资料,代码如下,程序完成后只能显示第一笔资料,其它资料都不能遍历,请高手指点!!!

private void First_btn_Click(object sender, EventArgs e)
{
this.BindingContext[customersDataSet.Customer].Position = 0;
}

private void Next_btx_Click(object sender, EventArgs e)
{
this.BindingContext[customersDataSet.Customer].Position +=1;
//this.BindingContext[customersDataSet,"Customer"].Position +=1;

}

private void Pre_btn_Click(object sender, EventArgs e)
{
this.BindingContext[customersDataSet.Customer].Position -= 1;
}

private void Last_btn_Click(object sender, EventArgs e)
{
this.BindingContext[customersDataSet.Customer].Position = this.BindingContext[customersDataSet.Customer].Count-1;
}

[解决办法]
bindingContext是VS2003时代的技术,没用过。
VS2005新增BindingSource,
BindingSource有四个方法,可以满足你的要求

读书人网 >C#

热点推荐