next record RRS feed

  • Question

  •  My name is Norm, I am developing a visual Studio Windows application. I can display the data just fine but when I try to go to the next record I get the message 'child list for field owner cannot not be created' the code that I am using is the following. Please help me understand what's wrong. I have used this code in other forms. My email is 'nbicc@hotmail.com'


    private void next_Click(object sender, EventArgs e)



    this.BindingContext[dsOwner1, "owner"].Position += 1;

                onum = txtOnum.Text;

                osave = txtOnum.Text;



    Friday, August 23, 2013 11:20 PM


  • Hi Norm,

    We're going to need more info than that, but a first guess is that you've gone past the last position in your "owner" table when you added to the .Position? Although, I would have thought the error message would be different, but I'm not sure about that. You should check the Rows.Count of your DataTable. Something like this:

    if (this.BindingContext[dsOwner1, "owner"].Position < dsOwner1.Tables["owner"].Rows.Count -1)
        this.BindingContext[dsOwner1, "owner"].Position += 1;

    ~~Bonnie Berent DeWitt [C# MVP]


    • Proposed as answer by Fred Bao Monday, August 26, 2013 2:26 AM
    • Marked as answer by Fred Bao Friday, August 30, 2013 1:14 AM
    Saturday, August 24, 2013 4:49 PM