Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > how to join up a string and a integer to be a object name ?

Reply
Thread Tools

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

 
 
THY
Guest
Posts: n/a
 
      11-08-2003
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.


 
Reply With Quote
 
 
 
 
Jos
Guest
Posts: n/a
 
      11-08-2003
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


 
Reply With Quote
 
 
 
 
THY
Guest
Posts: n/a
 
      11-08-2003
Thanks a lot !



"Jos" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
John Saunders
Guest
Posts: n/a
 
      11-08-2003
"THY" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
THY
Guest
Posts: n/a
 
      11-08-2003
This is a good way too, thanks John !

"John Saunders" <john.saunders at surfcontrol.com> wrote in message
news:(E-Mail Removed)...
> "THY" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[os.path.join(r'E:\Python', name) for name in []] returns [] iMath Python 9 01-30-2013 02:17 AM
Re: [os.path.join(r'E:\Python', name) for name in []] returns [] Jean-Michel Pichavant Python 0 01-29-2013 01:33 PM
is there a way to AutoParse a string to another type - e.g. if aDate format then date, else if integer than Integer etc ????? Greg Hauptmann Ruby 6 08-06-2008 04:52 PM
Change a string to an integer, report an error if the string does not represent an integer? Randy Kramer Ruby 12 10-25-2007 09:56 PM
Re: Urgent! how to get object name, method name and attribute name based on the strings? ding feng C++ 2 06-25-2003 01:18 PM



Advertisments