Easy need to add ddl to loop

T

TN Bella

Hi!

The following loop works great, but I want to add the following to it,
but not sure how since the others are textboxes and this is a
dropdownlist (ddl).

txtinvloc.SelectedItem.Value

for i = 0 to 14
'Dim strNumber as string =
sender.Name.Substring(Len("txtacctnum"))
Dim tb as TextBox
Dim tc as TextBox
Dim td as TextBox
Dim te as TextBox

if i = 0 then
'Looks for the txtacctnum
'loops through all txtacctnum, checking
txtacctnum, txtacctnum1, ... txtactnum14
tb = CType(FindControl("txtAcctNum"),
TextBox)
tc = CType(FindControl("txtCostCntr"),
TextBox)
td = CType(FindControl("txtRefNum"),
TextBox)
te = CType(FindControl("txtAcctAmt"),
TextBox)

else
'Looks for txtacctnum0 - txtacctnum14
tb = CType(FindControl("txtAcctNum" & i),
TextBox)
tc = CType(FindControl("txtCostCntr" & i),
TextBox)
td = CType(FindControl("txtRefNum" & i),
TextBox)
te = CType(FindControl("txtAcctAmt" & i),
TextBox)
End If
if (Not IsNothing(tb)) AndAlso len(tb.Text) >
0 then


Also how do I display it later on in my case statement?
this is how the other was used:
If tc.Text = "" Then
lblResult3.Text = "Please enter
a cost center."

elseif txtinvloc.SelectedItem.Value =
"081" <<<<<------how do I display


I tried selected.item.value and others but I need to figure it
out...thanks!!! I don't want to rewrite the code, just add that
line...thanks!!!
 

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,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top