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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bind DataRepeater at Runtime for Windows Forms

Status
Not open for further replies.

Auguy

Programmer
May 1, 2004
1,206
US
OK, this is driving me crazy.
I Can't seem to get a data repeater to show data when I bind at runtime to either a data table or a binding source.
The repeater shows the correct number of rows, just no data.
I checked the data is there in the table.
Seems like this should be easy, I must be missing something simple.
I have it working setting up all of the binding at design time, but can't seem to get it to work at runtime.
I have tried the following, with and without virtual mode.
Please help!
Code:
'This code is in the load of the form.
myDt = SelectRouting() 'SQL Proc
myBs = New BindingSource
myBs.DataSource = myDt
myBs.Sort = "prorefint, seqno"

txtVendName.DataBindings.Add("Text", myBs, "VendName")
DataRepeater2.DataSource = myBs

' OR
txtVendName.DataBindings.Add("Text", myDt, "VendName")
DataRepeater2.DataSource = myDt


Auguy
Sylvania/Toledo Ohio
 
What does SelectRouting do? I don't see any code for that. Maybe the problem could be located to that.
 
Forgot about this post, but thanks for responding.
Code:
SelectRouting()
is just a procedure to retrieve some data from the database.

I got it to work with setting the data binding of the textboxes at design time but wanted to do it at run time.
Not sure what I was doing wrong before but this seems to work now and not setting the data repeater binding source.
Code:
txtVendName.DataBindings.Add("Text", myBs, "VendName")


Auguy
Sylvania/Toledo Ohio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top