473,320 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

refrence a form object using a varible.

for the sake of making my crazy question eaiser to understand i will
try to simplify it as much as possible.

Let's say I have a form with one textbox (txtname) and one button
(bntGo). How would i go about changing the "text" attribute of the
textbox using the var "name"?
I am sure that this is a noob question. but then agian i am a noob to
VB.Net. I have tried many searches but i guess i have not been able to
state my question good enough for google.

<bad syntax I know>
dim name as string = "txtName"
Private Sub btnG0_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

name.text = "xnakx"

End Sub
</bad syntax I know>

Sep 29 '06 #1
1 934
This does what you want:

Me.Controls(name).Text = "xnakx"

Sep 29 '06 #2

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

Similar topics

1
by: Abby Lee | last post by:
I hard coded "TheYear" (the table) and "MonthPD" (a field) into my script to make sure the query worked (it did)...so now I want to replace an actual year (table) with varible which the next step...
1
by: Greg Phillips | last post by:
Hello everyone, I have read the section on templates in The C++ Programming Language 3rd edition 3 times over the last 4 days. Still I am stumped. I'll explain a bit about what I am doing...
2
by: | last post by:
i have a form name Form1 i want to create a copy of Form2 which know th refrence of Form1. example: private: System::Void button1_Click(System::Object * sender, System::EventArgs * e) { Form2...
6
by: Shane Saunders | last post by:
I have a menu option that loads a form and displays infomation. if you go to main form and try to load something else from that same menu, it does a check to see if the form in exist and then...
1
by: John Rugo | last post by:
Hi All, I would like to know how to set an object from a string provided? Here is the situation: I have a listview that holds the names of ListView Objects on different forms. I want to set...
161
by: KraftDiner | last post by:
I was under the assumption that everything in python was a refrence... so if I code this: lst = for i in lst: if i==2: i = 4 print lst I though the contents of lst would be modified.....
5
eragon
by: eragon | last post by:
I am making a password script, i have most of it done, ill show you, but i hit a brick wall.... lol, I have it so when you log in it takes you to your main page, that works, but when you enter the...
3
by: preitymathur0422 | last post by:
I m working on a MDI application. Here on the parent form I had two variables declared as public int curUserID = 0, ViewUserID = 1; the form is inherited by the "Form" class. I m using these...
2
by: sakat | last post by:
<?php $dbhost = 'unix.lsbu.ac.uk'; $dbuser = 'lrc3'; $dbpass = 'dietdft_'; $dbname = 'lrc3'; // This is an example open a db $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.