none
How to pass command line arguments to Windows Form RRS feed

  • Question

  • Hi,
     
    I am actually trying to convert 1 of the console program to windows form. And I am encountering 1 problem. I need to pass a parameter from a program to windows form when I call for the .exe file.

    For example C:\MyWindowsForm.exe fileName


    I need the fileName parameter to be able to recognize by WindowsForm program and started processing this parameter. How can I pass in the fileName parameter in Windows Form? I only know how to do it in console program.

    Leo
    Monday, December 29, 2008 9:13 AM

Answers

  • Nothing just put this command, in formload event to read it

    If My.Application.CommandLineArgs.Count > 0 Then
                MessageBox.Show(My.Application.CommandLineArgs(0))  'first item thats your filename
            End If

    Arjun Paudel
    • Marked as answer by leotheram Monday, December 29, 2008 9:53 AM
    Monday, December 29, 2008 9:33 AM

All replies

  • Nothing just put this command, in formload event to read it

    If My.Application.CommandLineArgs.Count > 0 Then
                MessageBox.Show(My.Application.CommandLineArgs(0))  'first item thats your filename
            End If

    Arjun Paudel
    • Marked as answer by leotheram Monday, December 29, 2008 9:53 AM
    Monday, December 29, 2008 9:33 AM
  • Thanks a lot! :)
    Monday, December 29, 2008 9:45 AM