Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Binding controls to an empty dataset/table

Status
Not open for further replies.

Durkin

Programmer
Nov 6, 2000
304
GB
I have a data maintenance form which is designed for one record at a time. I want to be able to open the form and bind the controls to an empty dataset but when I try to do an '.AddNew' on the BindingManagerBase it says 'DataBinding could not find a row in the list that is suitable for all bindings'.
I have made a call to the database to retreive the dataset structure but the table I want to insert into is empty.
I would rather not have to build a datarow manually if at all possible. Any help/ideas?

Durkin
 
Put here the code for the AddNew() and Coumt() methods that you already overloaded in the derived class from BindingManagerBase.

-obislavu-
 
I haven't derived the BindingManagerBase. What I've done is as follows:
Code:
Dim Mgr as BindingManagerBase = Me.txtFU_Name.DataBindings("Data").BindingManagerBase

and then:
Code:
Mgr.EndCurrentEdit()

Durkin
 
Your question was about .AddNew() and the code that you provided is not enough.

-obislavu-

 
Apologies, I should have said
Code:
Mgr.AddNew()

Anyway, I have decided to leave the controls unbound and use Datatable.NewRow to create my new row. Not as simple as I had hoped but it works. Thanks for your time.

Durkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top