VB.net Expression expected

Murray Brown
Murray Brown used Ask the Experts™
on
Hi. In the following VB.net class code I get the error "Expression expected"
on the line I marked with a note on the first "&". The error is expression expected

Public Class Class1


   Private pJoinTables As String

    Property JointTables() As String
        Get
            Return pJoinTables
        End Get
        Set(ByVal sValue As String)
            If (Not pJoinTables.Contains(sValue)) Then
                pJoinTables = pJoinTables & ',' & sValue 'Error on this line first &
            End If
        End Set
    End Property




End Class
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Public Class Class1


    Private _pJoinTables As String

    Property JointTables() As String
        Get
            Return _pJoinTables
        End Get
        Set(ByVal sValue As String)
            If (Not _pJoinTables.Contains(sValue)) Then
                _pJoinTables = _pJoinTables & "," & sValue 'Error on this line first &
            End If
        End Set
    End Property

End Class

Open in new window

Murray BrownASP.net/VBA/VSTO Developer

Author

Commented:
Thanks very much. Is it possible to explain briefly why that made a difference
& is concat operator and it expects string as input parameters and we represent constant strings with double quotes...
Murray BrownASP.net/VBA/VSTO Developer

Author

Commented:

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial