473,385 Members | 1,610 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,385 software developers and data experts.

how to join up a string and a integer to be a object name ?

THY
Hi,

Assuming that I have 5 textboxes, they are textbox1, textbox2, textbox3,
textbox4, textbox5.
and now I am on a for loop as below. but how can I make it join the word
"textbox" and my i value together and be a textbox object ?

it should be something like that, but I dont know the real coding.

for i = 1 to 5
("textbox" & i).text = "hello"
next
anyone know it ?

your help is real appreaciated. Thanks.
Nov 17 '05 #1
4 969
Jos
THY wrote:
Hi,

Assuming that I have 5 textboxes, they are textbox1, textbox2,
textbox3, textbox4, textbox5.
and now I am on a for loop as below. but how can I make it join the
word "textbox" and my i value together and be a textbox object ?

it should be something like that, but I dont know the real coding.

for i = 1 to 5
("textbox" & i).text = "hello"
next


CType(FindControl("textbox" & i),TextBox).Text="Hello"

--

Jos
Nov 17 '05 #2
THY
Thanks a lot !

"Jos" <jo***************@fastmail.fm> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
THY wrote:
Hi,

Assuming that I have 5 textboxes, they are textbox1, textbox2,
textbox3, textbox4, textbox5.
and now I am on a for loop as below. but how can I make it join the
word "textbox" and my i value together and be a textbox object ?

it should be something like that, but I dont know the real coding.

for i = 1 to 5
("textbox" & i).text = "hello"
next


CType(FindControl("textbox" & i),TextBox).Text="Hello"

--

Jos

Nov 17 '05 #3
"THY" <th*@streamyx.com> wrote in message
news:eU**************@TK2MSFTNGP12.phx.gbl...
Hi,

Assuming that I have 5 textboxes, they are textbox1, textbox2, textbox3,
textbox4, textbox5.
and now I am on a for loop as below. but how can I make it join the word
"textbox" and my i value together and be a textbox object ?

it should be something like that, but I dont know the real coding.

for i = 1 to 5
("textbox" & i).text = "hello"
next


Private textBoxArray As TextBox() = New TextBox() {textbox1, textbox2, ...
textbox5}

For i = 1 To 5
textBoxArray(i).Text = "hello"
Next

--
John

Nov 17 '05 #4
THY
This is a good way too, thanks John !

"John Saunders" <john.saunders at surfcontrol.com> wrote in message
news:uZ**************@tk2msftngp13.phx.gbl...
"THY" <th*@streamyx.com> wrote in message
news:eU**************@TK2MSFTNGP12.phx.gbl...
Hi,

Assuming that I have 5 textboxes, they are textbox1, textbox2, textbox3,
textbox4, textbox5.
and now I am on a for loop as below. but how can I make it join the word
"textbox" and my i value together and be a textbox object ?

it should be something like that, but I dont know the real coding.

for i = 1 to 5
("textbox" & i).text = "hello"
next


Private textBoxArray As TextBox() = New TextBox() {textbox1, textbox2, ...
textbox5}

For i = 1 To 5
textBoxArray(i).Text = "hello"
Next

--
John

Nov 17 '05 #5

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

Similar topics

9
by: Derek Hart | last post by:
I wish to execute code from a string. The string will have a function name, which will return a string: Dim a as string a = "MyFunctionName(param1, param2)" I have seen a ton of people...
4
by: jason | last post by:
Hello. Newbie on SQL and suffering through this. I have two tables created as such: drop table table1; go drop table table2; go
0
by: Gareth Stretch | last post by:
Hi Guys. i am using C#.net connecting to an Access database using OleDbConnection i am using the following select Statement to join 3 tables string strdvds = "SELECT dvd.name,...
7
by: Chris | last post by:
I'm using ASP.NET and SQL Server and this might be an obviuos question for most, but if I have a table that contains several fields that I need to relate to just one field in another table, how do...
5
by: Barry | last post by:
Hello, In VS2003, I tried using an enum and setting it into a field in a datarow. It seems as if the datatype of the field in the row determined what went into the field. If the datatype was...
1
by: Sankalp | last post by:
Hi, I am using VB 2005. My application has many data bound controls. The connection is stored in the app.config file. I want the application to start with a default connection string and while...
2
by: Chicken15 | last post by:
Hi Group. First of all I'm sorry for asking (maybe) such easy questions. But I'm quite stuck now and couldn't come up with a solution by using my C# book or googling. So it would be nice if...
1
by: kellysgirl | last post by:
Now what you are going to see posted here is both the set of instructions I was given..and the code I have written. The instructions I was given are as follows In this case, you will create...
2
by: Bart | last post by:
Hi, i get the error "BC30518:Overload resolution failed because no accessible 'Join' can be called with these arguments" at line: hvd = Join(hvertp, ",") Any idea what's wrong here? Thanks...
0
by: TG | last post by:
Hi! Once again I have hit a brick wall here. I have a combobox in which the user types the server name and then clicks on button 'CONNECT' to populate the next combobox which contains all the...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.