473,396 Members | 2,068 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,396 software developers and data experts.

problem iterating through textboxes

I have 10 sections on my page - -
in each section I have 2 textboxes, named similarly (txtIn/txtOut), but
adding the number to the id - - so it's like txtIn1, txtOut1, txtIn2, etc

I'm trying to iterate through them and check to see if each has text in
them:

Dim iCheck as Integer
Dim sNum as string
Dim txtIn As New TextBox
Dim txtOut As New TextBox
For iCheck = 1 To 10

sNum = iCheck.ToString
txtIn.ID = "txtIn" & sNum
txtOut.ID = "txtOut" & sNum

If txtIn.Text <"" Or txtOut.Text <"" Then ' problem here - see below
' do processing here
else
'whatever
End If

Next iCheck

When debugging, in the 'If' statement, the textbox IDs are correct, but, no
matter what, they always show "" as the Text property, but they definitely
do have text - -

What am I doing wrong

Feb 14 '08 #1
1 910

I thought I'd add - - that when I say sections, each section is a row in an
HTML table and it's all inside an UpdatePanel

"Elmo Watson" <sm@here.comwrote in message
news:OJ**************@TK2MSFTNGP05.phx.gbl...
>I have 10 sections on my page - -
in each section I have 2 textboxes, named similarly (txtIn/txtOut), but
adding the number to the id - - so it's like txtIn1, txtOut1, txtIn2, etc

I'm trying to iterate through them and check to see if each has text in
them:

Dim iCheck as Integer
Dim sNum as string
Dim txtIn As New TextBox
Dim txtOut As New TextBox
For iCheck = 1 To 10

sNum = iCheck.ToString
txtIn.ID = "txtIn" & sNum
txtOut.ID = "txtOut" & sNum

If txtIn.Text <"" Or txtOut.Text <"" Then ' problem here - see
below
' do processing here
else
'whatever
End If

Next iCheck

When debugging, in the 'If' statement, the textbox IDs are correct, but,
no matter what, they always show "" as the Text property, but they
definitely do have text - -

What am I doing wrong



Feb 14 '08 #2

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

Similar topics

4
by: Paxton | last post by:
At the risk of being told "If it ain't broke, don't fix it", my code works, but is ugly. Part of the admin site I'm working on at the moment includes a facility for users to enter Formulations...
0
by: Kathy Burke | last post by:
Hi, I have an html form (created by transforming an xml doc with an xsl stylesheet and sent as html within an asp.net page. The doc is a set of user instructions steps. For each of the...
11
by: ian.davies52 | last post by:
Is there anything I can do about the apparent limit on the number of textboxes that have calculations as their control source on a form or report in ms-access? I have a query that pulls together...
1
by: Jeremy | last post by:
I have been trying to iterate through the controls on my form and preset all textboxes to a cssClass. Unfortunately, I have been unable to figure out how to recursively move through sub-controls...
7
by: Joel Finkel | last post by:
Folks, I have a form that has several TextBoxes, some of which have the TextMode set to MultiLine. Each is pre-loaded with data from a database. The user is allowed to modify each entry. The...
6
by: Dany P. Wu | last post by:
Hi everyone, I created a page which contains a two-column table. The first column has a bunch of labels, and the second a bunch of textboxes. Here's the code: ...
1
by: Tommy | last post by:
I have a nested repeater. It displays the data correctly, etc.. I have a problem however.. when i iterate through the textboxes in my code all of the values of the text property are empty. I need...
7
by: Peter D.C. | last post by:
Hi I want to update data hold in several textbox controls on an asp.net form. But it seems like it is the old textbox values that is "re-updates" through a stored procedure who updates a SQL...
0
by: anandv81 | last post by:
Hi, I encountered a strange problem while working on an application, the problem goes like this. I am generating a few textboxes at runtime at the server side and added to a placeholder, a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
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
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,...

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.