Results 1 to 2 of 2
Like Tree1Likes
  • 1 Post By Herman

Thread: A program that will return a value

  1. #1
    Bryan_James is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Apr 2015
    Location
    Manila, Philippines, Asia, Earth
    Posts
    5
    Reputation
    0

    Question A program that will return a value

    Hi!
    I've been wondering, can the Main method return something? All this time I coded Main as a Sub and not a Function.
    In C, I can return an integer value at the end of main. Is this possible in VB.NET?

    I tried:
    Code:
    Module Module1
    
        Function Main(ByVal args() As String)
    
    
            Return 0
        End Function
    
    
    End Module
    But this doesn't work. Thanks in advance!

  2. #2
    Herman is offline VB.NET Forum Idol
    .NET Framework
    .NET 4.0
    Join Date
    Oct 2011
    Location
    Montreal, QC, CA
    Posts
    865
    Reputation
    1210
    This should work:

    Function Main(ByVal args() As String) As Integer
    ...
    Return 0
    End Function


    But the real question is how are you verifying that it does or doesn't work?
    Bryan_James likes this.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •