我用四个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;
        }

解决方案 »

  1.   

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

  2.   

    我使用了BindingSource的方法还是没有反应
    连接了数据库
    bindingSource1.MoveFirst();
    this.bindingSource1.MoveNext();
    this.bindingSource1.MovePrevious();
    this.bindingSource1.MoveLast();
    使用
    MessageBox.Show(bindingSource1.Count.ToString());  ==》显示为 1
      

  3.   

    问题已经搞定了,是我的bindingSource1设定错了,谢谢了