In A Rush, Properly Handled, and More
by in Coded Smorgasbord on 2010-03-10"This code was left by the Senior Software Consultant," Michael Wheeler writes, "I'm not sure if it's insurance against 'Return' not returning... or a comment that explained why the line of code was left in."
Public Shared Function GetItemFromValue(ByVal ddlControl As DropDownList) As Integer
Dim i As Integer
If ddlControl.Items.Count > 0 Then
For i = 0 To ddlControl.Items.Count - 1
If ddlControl.Items(i).Selected() Then
Return i
Exit For 'leaving this here cause we're in a rush
End If
Next
End If
End Function