Can this be done?

T

Tony Van

Is there any way to construct a line of code in a VB.net
program from a string?

Something like this...
Dim sStr As String = "txtName"

Dim sField As String = "name"

Dim cCmd As String

cCmd = sStr & ".DataBindings.Add('Text', myADO.ds, 'snat.'"
& sField & ")"

..... and make cCmd a line of code that looks like:

txtName.DataBindings.Add("Text", myADO.ds, "snat.name")

Hope this is not too dumb a newbie question. Thanks.
 
G

Guest

No, there isn't a way to do this. Well....There isn't a <i>nice</i> way to
do this and it does introduce a <i>huge</i> performance penalty. Also, there
is just about never a reason to do this. If you do think you need to do
this, your first step should be to rethink how you want to achieve your
results. You'll find that there is always an alternate method that works
better.

For instance...In your case, adding all of your TextBox's to your own
collection or array would achieve the same results without having to worry
about their names.
 

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