vb.net - command line arguments works in visual studio but not from command line for a WindowsForm project in Visual Basic -
I have a small program in visual origin. It inserts a file and uploads the file to an FTP server, the program works well on itself.
My problem is that I think it is does not appear as a separate wanted to treat me if it is takes arguments from the command line or no logic, no and if the load does not form
codes are command-line arguments work properly when the scene killed the basic (project properties - & gt ;. debug - & gt; starting place - & gt
but when I Execute the program with this line from CMD: pogram.exe C: \ users \ user \ File.txt
The form shows and no argument reveals
The key factor for the dispatch
Module1.vb: ..
Module Module1 declared function AttachConsole Lib "kernel32" (ByVal dwProcessId Int32) as Boolean declared function FreeConsole Lib "kernel32.dll" (as Boolean sub main (in)) dim cmdArgs string (in) = as GetCommandLineArgs () Form2kloadData () so cmdArgs.Length = 0 then 'not ARGS MODE mainWindow.commandLineMode = false Aplikeshnkrn (main window) Aelsaif Simdiaarjis. Landai & lt; 3 and Form2.TXTnumLi Cence.Text = "" Then bad ARGS number Console.WriteLine ("Aucun Numero de license definit usage. ./ODG_exchange ['FilePath'] [numeroLicence [default = ./ODG_param.xml & gt; Numero_licence]] ") Application.Exit () Otherwise 'ARGS mode mainWindow.commandLineMode = true mainWindow.commandeLine (cmdArgs) end then End Sub In Visual Studio I also startup as Module1 defined object. this may be useful
there is always args the command line -. implemented Program file name.You must change your statement to CMDARGS.Length = 1
Comments
Post a Comment