Bind Dynamically Added Textbox

R

Randy

Can anybody help me to complete the code for a dynamically added
textbox? I can get as far as adding the textbox and placing in the
right location, but now I need to bind it to a datasource. Here is my
code thus far:

Dim TextBox As New TextBox
With TextBox
.Name = "textBox" & tbl.rows.count + 1
.Size = New System.Drawing.Size(320, 20)
.Location = New Point(205, 160)


End With
Controls.Add(TextBox)

I was hoping to add a line within the With statement like ".datasource
= ds" and ".datamember = myColumn", but these are apparently not valid
members in this context.

Can anybody help?
Thanks,
Randy
 
C

Cor Ligthert [MVP]

Martin,

I see that I did not pay enough attention to the word bind.

However a dataset is a binder so it need in my idea to be a table.

MyTextBox.databindings.add("text",ds("myTable"),"MyColumn")
or
MyTextBox.databindings.add("text",myTable,"MyColumn")
or Strongly Typed
MyTextBox.databindings.add("text",ds,myTable,"MyColumn")

This because that part gives mostly the most confusion.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top