CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2015
    Posts
    7

    How to make function string with Visual Basic 2013?

    Is this the right way to make an string function Look at the code below this text.
    Can someone help me if the code is wron? I'm using the Visual Basic 2013 software.

    Code:
    function weburl() As String
            Dim ProcessProperties As New ProcessStartInfo
            ProcessProperties.FileName = "iexplore.exe"
            ProcessProperties.Arguments = "http://www.google.com"
            ProcessProperties.WindowStyle = ProcessWindowStyle.Maximized
            Dim myProcess As Process = Process.Start(ProcessProperties)
    end function
    
    weburl("http://www.google.com")

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: How to make function string with Visual Basic 2013?

    Actually that should be a sub rather than a function as it is not returning a value.
    You also need to specify a argument in the sub definition if you want to pass it something

    Code:
    Sub weburl(TheUrl as String)
            Dim ProcessProperties As New ProcessStartInfo
            ProcessProperties.FileName = "iexplore.exe"
            ProcessProperties.Arguments = TheUrl
            ProcessProperties.WindowStyle = ProcessWindowStyle.Maximized
            Dim myProcess As Process = Process.Start(ProcessProperties)
    end Sub
    
    weburl("http://www.google.com")
    Always use [code][/code] tags when posting code.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured