473,511 Members | 12,017 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can this be done?

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.
Jun 27 '06 #1
2 1111
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.

--
<i><b>RageInTheMachine9532</b></i><font size="-2">
"<i>...a pungent, ghastly, stinky piece of cheese!</i>" <b>-- The Roaming
Gnome</b></font>
"Tony Van" wrote:
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.

Jun 28 '06 #2
Thanks Dave for pointing me in the right direction. I forgot
about collections.


"Tony Van" <to*********@comcast.net> wrote in message
news:YN******************************@comcast.com. ..
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.

Jun 28 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1672
by: itsharkopath | last post by:
Hi, Imagine a user in a hotspot, when he comes to the hotspot and tries to load a webpage (on the internet), he would automatically redirected to login page. I believe the following is to be...
9
1710
by: Steven T. Hatton | last post by:
This was written for the gnu.g++.help list. It rather clearly spells out the most important feature of Java that I believe C++ lacks. I really don't believe the C++ Standard sepcifies enough for a...
16
2931
by: jaialai technology | last post by:
I want to reload a url in a browser window so I do something like this: open(window.location.href= "www.yahoo.com"); ok, so now I want to do something when that page is done loading completely....
5
1378
by: Morten Overgaard | last post by:
Hi I have a C# component which fires events. I want to catch these events in my MFC app compiled with the /clr. I know I can define a managed class in my MFC app which traps the events - but I...
11
17806
by: Sharon | last post by:
I'm writing a new control derived from UserControl. I need to get an event when the control is done resizing. I tried the Resize, SizeChanged, Move and the Layout events and I also tried to...
3
1374
by: Miguel Dias Moura | last post by:
Hi, When I subscribe a web site I usually receive an email to confirm my subscription. Only after I follow the link in the email my account gets activated. In general, how is this done? Can...
4
1414
by: BrianDH | last post by:
Group Early this week I ask for examples on how to call a VB.NET Web Service and access its DataSet for a traditional ASP page. I was told, "you can't", "won't work", "not possible". Well I...
12
2606
by: Ark | last post by:
Hello NG, I arrange data in structs like { members... uint16_t crc; more members, maybe... } Then I need to save them, up to and including crc, in non-volatile memory or a file, as the case...
2
1872
by: maya | last post by:
http://news.yahoo.com/news?tmpl=index2&cid=703 down the page, under "More Stories", there's a section with two interchangeable divs which slide back and forth into view.. how is this done? I...
2
3366
by: poolboi | last post by:
hey guys, i've done most of my web app. for searching almost done but then i got a small little problem with logging in i need to know how session tracking is done in perl if not my log in page...
0
7148
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7517
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5673
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
451
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.