End of statement expected

r3nder
r3nder used Ask the Experts™
on
 Public Sub _EMPPINENTERED() [b]As String() = Nothing [/b]
    End Sub
    Public ReadOnly Property EMPPINENTERED() As String()
        Get
            Return EMPPINENTERED = DesanitizeMap(Convert.ToString(EMPPINENTERED))
        End Get

    End Property

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Éric MoreauSenior .Net Consultant
Top Expert 2016

Commented:
what are you trying to do? I can't even read the code!
Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Top Expert 2009

Commented:
*** Wild Guess! ***

You're probably trying for something like this:
    Private _EMPPINENTERED As String() = Nothing

    Public ReadOnly Property EMPPINENTERED As String()
        Get
            Return DesanitizeMap(_EMPPINENTERED)
        End Get
    End Property

Open in new window

Top Expert 2015
Commented:
And except for a comment, you cannot enter anything after the declaration of a sub. The thus compiler sees your As String() = Nothing as misplaced, because you should have an end of line after the ( ), thus the error message that you get

Also, As String() = Nothing is meaningless in VB syntax. You seem to be using some kind of tag, but VB does not uses tags. Where does this syntax comes from? In which language?

Éric has a very good question, and Mike a guess that is in my opinion the best thing a VB programmer could understand from what you sent us.

Please, when you post something, add some details. Seeing your code, we can easily spot why you get that particular error message, but we have not enough details with the simple post title and code to understand what you are doing and give you a solution.
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

Top Expert 2015
Commented:
And seeing the result of posting my answer, where I simply cut and paste what you put at the end of the declaraion, I suddenly understand that you possibly wanted to attract the attention to that part of the code by displaying it in bold. This does not work inside of code blocks in the Expert-Exchange interface.

Which lead me to think that what you wanted to do was the following:

 Public Sub _EMPPINENTERED() As String()

This does not work, because a Sub does not return any value. So, once again, you get that error message because the compiler expects the end of the line after _EMPPINENTERED().

When you want to return a value in VB, you define a Function, not a Sub.

 Public Function _EMPPINENTERED() As String()
     Return a     'Where a is the string array that you want to return as a result
 End Function

But that would not make much sense, because why would you need a function and a property with basically the same name. Once again, Mike's guess might have more sense.
ǩa̹̼͍̓̂ͪͤͭ̓u͈̳̟͕̬ͩ͂̌͌̾̀ͪf̭̤͉̅̋͛͂̓͛̈m̩̘̱̃e͙̳͊̑̂ͦ̌ͯ̚d͋̋ͧ̑ͯ͛̉Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015

Commented:
I'll only add that it's bad style to write a property which executes a method under the hood. As a consumer of your property, I should expect that accessing your property has no side effects on the class itself. It's apparent from the code that you've posted, but I would be concerned about what the DesanitizeMap method is actually doing. If you are going to call a method from within a property, then just make a method, and your new method calls the DesanitizeMap. Methods are expected to potentially incur side effects.

Author

Commented:
ThanksJACK AND mike,
it woks now

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