Kbase 21222: OPEN CLIENT: Implementing VB Equivalent to 4GL LOOKUP Function
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  8/9/2007 |
|
Status: Unverified
GOAL:
How to implement the 4GL LOOKUP function in Visual Basic.
FIX:
Public Function Lookup _
(ByVal cExpression As String, _
ByVal cList As String, _
Optional ByVal cDelimiter As String = ",") As Long
Dim cElement() As String
Dim iLoop As Long
cElement = Split(cList, cDelimiter, -1, vbTextCompare)
For iLoop = LBound(cElement) To UBound(cElement)
If cExpression = cElement(iLoop) Then
Lookup = iLoop + 1
Exit Function
End If
Next iLoop
Lookup = 0
End Function