Displaying Next Rec

ValiantKhan

Member
Joined
Aug 4, 2003
Messages
8
Allo, Im having some difficulty with displaying the next record in the database.

I have a DataSet DsUsers1 that has my users table in it.
I have a text box binded to a field name in my sql database.
On my Button Load click event I tell it to do --
"DsUsers1.Clear()
OdbcDataAdapter1.Fill(DsUsers1)"

Which works fine, and it displays the first record in my database. But when I go to display the next one by using the following code

"Me.BindingContext(DsUsers1, "Name").Position += 1"

it gives me error --

An unhandled exception of type System.ArgumentException occurred in system.windows.forms.dll

Additional information: Cannot create a child list for field Name.

Ive been getting that on all my navigation buttons, last, prev, next, first.

Any ideas on what im doing wrong?

And also another question -- When im using Me.BindingContext(DsUsers1, "Name") -- is there anyway i can tell it to update more than one field, say if i have a few more text boxes binded to different fields, and have it update those also when i click my next button?

Anywho, thanks for the help.

--Val
 
Valiant:

Im not sure if this is the correct answer for what you are trying to do, just throwing my suggestion.

When navigating records, I believe your bindingcontext statement should contain the table name in your dataset?

Example

BindingContext(dsuser1, "TableNameHere").position += 1

This method will change the values on all controls bound to that specific dataset/table to the next record in the dataset (answering your second question)

I sure hope this is what you were looking for.
 
ohhh i use the TableName, doh.. i was trying to put in the field name..

thanks, i think thats what i was doing wrong, Ill try it out and post back if i need any more help.

Thanks a bunch for the reply! Appreciate it!

--Val
 
Back
Top