473,320 Members | 1,948 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.

using a variable to represent a textboxname

TB
Hi All:

Is it possible to to use a variable to represent a textboxname? As I have a
form with a lot of similarly named textboxes to be populated by similarly
named colums from a table, I would like to do something like this
(pseudocode):

dim i as integer

for i = 0 to 10
txtbox(i).text = row.item("field" & i).ToString()
next

If the above is possible, what would be the exact code?

Thanks

TB
Mar 5 '06 #1
2 1039
TB wrote:
Hi All:

Is it possible to to use a variable to represent a textboxname? As I
have a form with a lot of similarly named textboxes to be populated
by similarly named colums from a table, I would like to do something
like this (pseudocode):

dim i as integer

for i = 0 to 10
txtbox(i).text = row.item("field" & i).ToString()
next

If the above is possible, what would be the exact code?


If you name your textboxes TextBox1, TextBox2, etc, you could do with

For i=0 to 10
Page.FindControl("TextBox" & i).Text = row.item("field" & i).ToString()
Next i

Enjoy the programming!

--

Riki
Mar 5 '06 #2
TB
Thanks a lot!

TB

"Riki" <ri**@dontnagme.com> wrote in message
news:Oo*************@TK2MSFTNGP15.phx.gbl...
TB wrote:
Hi All:

Is it possible to to use a variable to represent a textboxname? As I
have a form with a lot of similarly named textboxes to be populated
by similarly named colums from a table, I would like to do something
like this (pseudocode):

dim i as integer

for i = 0 to 10
txtbox(i).text = row.item("field" & i).ToString()
next

If the above is possible, what would be the exact code?


If you name your textboxes TextBox1, TextBox2, etc, you could do with

For i=0 to 10
Page.FindControl("TextBox" & i).Text = row.item("field" &
i).ToString()
Next i

Enjoy the programming!

--

Riki

Mar 6 '06 #3

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

Similar topics

1
by: weiwei | last post by:
Hi all How can I pass the variable in two button situation see below code <html> <body> <form action="" method="post"> <input type="text" name="name"> <input type="button" value="Add"...
6
by: Ramon M. Felciano | last post by:
Helo all -- I'm trying to gain a deeper understand for what type of semi-declarative programming can be done through XML and XPath/XSLT. I'm looking at graph processing problems as a testbed for...
7
by: bartek | last post by:
Hello, I've been pondering with this for quite some time now, and finally decided to ask here for suggestions. I'm kind of confused, actually... Maybe I'm thinking too much... Brain dump...
15
by: lawrence | last post by:
Sorry for the dumb question but I'm new to Javascript. I wrote this script hoping to animate some div blocks on a page. You can see the page here: http://www.keymedia.biz/demo.htm Can anyone...
18
by: Panchal V | last post by:
I want to access a variable length record in C, the format is as follows : +---+---+-----------+ | A | L | D A T A | +---+---+-----------+ A - Some Data (1 BYTE) L - Length the Data that...
7
by: ben | last post by:
hello, an algorithm book i'm reading talks about the connectivity problem/algorithm. it gives a number of examples where the connectivity problem applies to real life situations (like, the...
2
by: Kevin Frey | last post by:
Is it possible to get c# perform a using statement where the namespace for the using is not specified literally but instead comes from a variable, a token, a predefined value etc. We have...
39
by: Mark Odell | last post by:
I've always declared variables used as indexes into arrays to be of type 'size_t'. I have had it brought to my attention, recently, that size_t is used to indicate "a count of bytes" and that using...
4
by: lipsa | last post by:
Dear all, very new to asp.net 2.0.need help urgently. suppose i have 3 pages. page1- textboxname textboxage textboxAddress page2-
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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.