Results 1 to 2 of 2

Thread: Command-line arguments to listbox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2011
    Posts
    105

    Command-line arguments to listbox

    Hi guys I want to make my GUI app to run in command prompt, something like:

    app.exe -load http://....

    and I want to display http://.... in listbox

    I tried so many things but no luck so far.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Command-line arguments to listbox

    try this:

    Code:
    Public Class Form1
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim args() As String = Environment.GetCommandLineArgs
            If args.Length < 3 Then End
            Dim result As Uri = Nothing
            If Not Uri.TryCreate(args(2), UriKind.Absolute, result) Then End
            ListBox1.Items.Add(result.ToString)
        End Sub
    
    End Class

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