Returning String Array Values from a function....HELP!!!
-
Public Function Rating(ByVal iNPS As String, ByRef iRatings() As String) As String Select Case iNPS Case "1/2""" iRatings = {"150#", "300#"} 'This is the line where I get an error End Select End Function In the error list I get an "Expression Expected" error. I'm trying to return a string array so I can populate a combobox for a user. Any help would be much appreciated. Eric.
-
Public Function Rating(ByVal iNPS As String, ByRef iRatings() As String) As String Select Case iNPS Case "1/2""" iRatings = {"150#", "300#"} 'This is the line where I get an error End Select End Function In the error list I get an "Expression Expected" error. I'm trying to return a string array so I can populate a combobox for a user. Any help would be much appreciated. Eric.
Public Function Rating(ByVal iNPS As String, ByRef iRatings() As String) As String**()**
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
-
Public Function Rating(ByVal iNPS As String, ByRef iRatings() As String) As String**()**
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
-
Public Function Rating(ByVal iNPS As String, ByRef iRatings() As String) As String Select Case iNPS Case "1/2""" iRatings = {"150#", "300#"} 'This is the line where I get an error End Select End Function In the error list I get an "Expression Expected" error. I'm trying to return a string array so I can populate a combobox for a user. Any help would be much appreciated. Eric.
-
Public Function Rating(ByVal iNPS As String, ByRef iRatings() As String) As String Select Case iNPS Case "1/2""" iRatings = {"150#", "300#"} 'This is the line where I get an error End Select End Function In the error list I get an "Expression Expected" error. I'm trying to return a string array so I can populate a combobox for a user. Any help would be much appreciated. Eric.
You don't need to put a ByRef array in the header. You just need:
Public Function Rating(ByVal iNPS As String) As String()
Dim result As String()Select Case iNPS Case "1/2""" result = New String() {"150#", "300#"} . . . End Select Return result
End Function
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008