How to get SelectedItem.Text from DDL in an array

moc2469

Active member
Joined
Jun 21, 2007
Messages
27
Programming Experience
1-3
Hi,

This app. is a Schedule Maker for employees. I have a simple array of table names, in each table there are 15 dropdownlist's, 1 for Emp Name, 7 for time IN, and 7 for time OUT.

How do I retrieve the SelectedItem from the ddl in the array.

<code>
Dim sEmpName As String
Dim iC As Int16
Dim oTable(6) As HtmlTable
oTable(0) = Table1 'Actual table name
oTable(1) = Table2
oTable(2) = Table3
oTable(3) = Table4
oTable(4) = Table5
oTable(5) = Table6

For iC = 0 To UBound(oTable) - 1
sEmpName = oTable(iC).FindControl()?????
Next
</code>
 
Any Array in .NET can now use Length or Count to get the ammount of things in the array or collection. The Function UBound is a legacy function.

But here is a little snippet that should show you what to do. If this does not answer your question let me know:

VB.NET:
        Dim t As New HtmlTable()
        't.HasControls()
        For Each ctl As Control In t.Controls
            Dim ddl As DropDownList
            If TypeOf ctl Is DropDownList Then
                ddl = DirectCast(ctl, DropDownList)


            End If
        Next
 
That helps a little bit....I still cannot get the SelectedItem from the ddl.
 
Back
Top