Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Returning String Array Values from a function....HELP!!!

Returning String Array Values from a function....HELP!!!

Scheduled Pinned Locked Moved Visual Basic
helpdata-structures
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Herrwolf1
    wrote on last edited by
    #1

    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.

    N L D 3 Replies Last reply
    0
    • H Herrwolf1

      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.

      N Offline
      N Offline
      nlarson11
      wrote on last edited by
      #2

      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

      H 1 Reply Last reply
      0
      • N nlarson11

        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

        H Offline
        H Offline
        Herrwolf1
        wrote on last edited by
        #3

        Thank you for replying so quickly. I tried your suggestion and I still have the same problem. I am using vb.net express 2008. The blue squiggly line is under the first(opening) bracket.

        1 Reply Last reply
        0
        • H Herrwolf1

          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.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4
          Public Function Rating(ByVal iNPS As String, ByRef iRatings() As String) As String
              Select Case iNPS
                  Case "1/2"
                     **iRatings = New String() {"150#", "300#"}** 
              End Select
          End Function
          
          1 Reply Last reply
          0
          • H Herrwolf1

            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.

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups