problem iterating through textboxes

E

Elmo Watson

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
 
E

Elmo Watson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,068
Latest member
MakersCBDIngredients

Latest Threads

Top