Re: Deploy/Debug/Run VB .Net 2005 WinApp with Form or Formless

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Ruth wrote:
I am trying to deploy a Visual Basic .Net 2005 WinApp solution that can be run with or without a form. It should run with the form from the start menu. It should run formless from the command prompt when the switch is included.

The application runs fine in VS 2005 IDE with the form. I don’t know how to test the switch mode from the IDE (I deploy it and test the switch from a command prompt).

I used click once to deploy the application. When I run it at the start menu it works as expected - with the form. When I run it at the command prompt I select the exe that click once created followed by the switch - it runs both the form and formless options.

I am confused about this. Do you know what might be happening? I think it is running the exe with the form before the code is actually processed so the switch is recognized after the form is displayed.

Here is my sample code:
Public Sub Start()
'args = System.Environment.GetCommandLineArgs
'args = Split(Command$, " ")
Dim gOpenArgs() As String = Environment.GetCommandLineArgs()
Dim s As String
For Each s In gOpenArgs
Select Case s.ToLower
Case "/a" ' Automated
Dim LoadData As New ProcessCode
LoadData.RunFormless()
Application.Run()
Case Else
Form1.Show()
Application.Run()
End Select
Next
Application.Exit()
End Sub

Public Sub RunFormless()
Console.Beep()
Console.WriteLine("Hi")
Application.Exit()
End Sub

Q1 -Should I use click once to deploy or does anyone know how to deploy this solution as one application that runs from the start menu without the switch (with the form) and runs from the command prompt with the switch (No Form).

Q2 – How can I test the switch from the IDE window? I am not sure where/how to set the swtich in debug mode.


To test from the IDE:

Project --> Properties --> Debug (Tab) --> Command Line Arguments

From what I remember, you have to be careful about the way you parse the arguments because arg(0) may be different in different circumstances, meaning the switch you are looking for starts in arg(1).

HTH
.



Relevant Pages

  • Re: Bug or Not? Cmd Prompt/Switching Issue
    ... The programs i listed are just for examples, whenever i switch between any ... programs that command prompt will show, but particularily with mIRC, only ... the command prompt will flash once. ... A bug is a defect in the software code which doesn't allow the ...
    (microsoft.public.windows.vista.general)
  • Re: Invalid Switch Executing Dos "DIR /X" Command from BP7
    ... directory/file names to short directory/file names. ... is in fact a switch. ... I suspect that the "DOS" at your command prompt (boot into a DOS-like ...
    (comp.lang.pascal.borland)
  • Re: No explorer in safemode
    ... Click the Cancel button so that you do not reboot in Safe Mode. ... = This switch causes Windows to start in Safe Mode. ... Both switches = Safe Mode with Command Prompt. ... MS-MVP Windows Shell/User ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Filename list into Excel
    ... The Dir command in a command prompt will list your files with a date ... The /on switch exports the data in alphabetical order, ... As long as the /on switch is used, the filenames will be in the same ... > I need to generate a spreadsheet that contains the filename, ...
    (microsoft.public.excel.misc)
  • Re: Catastrophic Failure
    ... switch and made a fresh db with all the objects imported. ... Dim cnn As ADODB.Connection ... Dim prm As ADODB.Parameter ...
    (microsoft.public.access.forms)