shivboy
07-06-2006, 10:16 PM
Hi,
I have a combo box with some values in it. Now, I want to make a function wherein I pass the value of the combo box as a string parameter and return a specific string value corresponding to the string parameter passed. I am able to pass the parametric value, but the value returned is "blank" or "null" instead of the string value that the function should be returning. Why is this happening? Below is the code that I am using for the function and how I am passing the value into it. Please help.
Function convertDiv(oDiv As String) As String
Dim wDiv, oDivID As String
wDiv = oDiv
If wDiv = "A" Then
oDivID = "1"
ElseIf wDiv = "B" Then
oDivID = "2"
ElseIf wDiv = "C" Then
oDivID = "3"
ElseIf wDiv = "D" Then
oDivID = "4"
ElseIf wDiv = "E" Then
oDivID = "5"
ElseIf wDiv = "F" Then
oDivID = "6"
ElseIf wDiv = "G" Then
oDivID = "7"
End If
convertDiv = oDivID
End Function
Sub init()
Dim a As String
a = convertDiv(Trim(combo1.Value))
lblType.Caption = a
End Sub
Peace,
Shivboy
I have a combo box with some values in it. Now, I want to make a function wherein I pass the value of the combo box as a string parameter and return a specific string value corresponding to the string parameter passed. I am able to pass the parametric value, but the value returned is "blank" or "null" instead of the string value that the function should be returning. Why is this happening? Below is the code that I am using for the function and how I am passing the value into it. Please help.
Function convertDiv(oDiv As String) As String
Dim wDiv, oDivID As String
wDiv = oDiv
If wDiv = "A" Then
oDivID = "1"
ElseIf wDiv = "B" Then
oDivID = "2"
ElseIf wDiv = "C" Then
oDivID = "3"
ElseIf wDiv = "D" Then
oDivID = "4"
ElseIf wDiv = "E" Then
oDivID = "5"
ElseIf wDiv = "F" Then
oDivID = "6"
ElseIf wDiv = "G" Then
oDivID = "7"
End If
convertDiv = oDivID
End Function
Sub init()
Dim a As String
a = convertDiv(Trim(combo1.Value))
lblType.Caption = a
End Sub
Peace,
Shivboy