473,386 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Command Arguments and processing questions.

Hello Everyone,

I have this little app, that I would like to configure two modes of
operation by using command line arguments. If the app is started with no
arguments, the Main UserForm shows up, if the app is started with an argument
of -q it runs in Quiet Mode. Where a form pops up, runs the process I need
run without user intervention and then closes. I'm having a problem when the
app runs with -q, it starts the Quiet Mode form... but doesn't process any of
the code for the next steps I need run. Can someone help me out. I have
posted pertinent code snippets below.

-----------------------------------------------------
Module ProgramCode
Public Sub Main(ByVal CmdArgs() As String)
If (CmdArgs Is Nothing) OrElse (CmdArgs.Length = 0) Then
Application.Run(New frmMain)
ElseIf CmdArgs(0).Trim.ToLower = "-q" Then
Application.Run()
Dim quietForm As New frmQuiet
quietForm.QuietModeProcess()
End If
End Sub
End Module
-------------
Public Class frmQuiet
Inherits System.Windows.Forms.Form
Const applicationName = "OFAC File Generator"

#Region " Windows Form Designer generated code "
#End Region

Public Sub QuietModeProcess()
MsgBox("Now Procecssing Quiet Mode Steps", MsgBoxStyle.Information,
applicationName)
End Sub

End Class

--
Freedom isn't free... but the United States Marine Corps will pay most of
your share !!! Semper Fi!!
Jul 21 '05 #1
3 1344
Dubya <jw*****@gmail.com> wrote:
I have this little app, that I would like to configure two modes of
operation by using command line arguments. If the app is started with no
arguments, the Main UserForm shows up, if the app is started with an argument
of -q it runs in Quiet Mode. Where a form pops up, runs the process I need
run without user intervention and then closes. I'm having a problem when the
app runs with -q, it starts the Quiet Mode form... but doesn't process any of
the code for the next steps I need run. Can someone help me out. I have
posted pertinent code snippets below.


You're calling Application.Run(), which will block until either Exit or
ExitThread is called. I very much doubt that that's what you want it to
do. Why are you calling it at all?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2
I am using the Application.Run because if I use frmQuiet.Show to show the
form, the application quickly starts and shows the form, does no processing
and closes. I am a newer programmer and probably haven't architected this
quite right.

Any suggestions?

--
Freedom isn't free... but the United States Marine Corps will pay most of
your share !!! Semper Fi!!
"Jon Skeet [C# MVP]" wrote:
Dubya <jw*****@gmail.com> wrote:
I have this little app, that I would like to configure two modes of
operation by using command line arguments. If the app is started with no
arguments, the Main UserForm shows up, if the app is started with an argument
of -q it runs in Quiet Mode. Where a form pops up, runs the process I need
run without user intervention and then closes. I'm having a problem when the
app runs with -q, it starts the Quiet Mode form... but doesn't process any of
the code for the next steps I need run. Can someone help me out. I have
posted pertinent code snippets below.


You're calling Application.Run(), which will block until either Exit or
ExitThread is called. I very much doubt that that's what you want it to
do. Why are you calling it at all?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Jul 21 '05 #3
Dubya <jw*****@gmail.com> wrote:
I am using the Application.Run because if I use frmQuiet.Show to show the
form, the application quickly starts and shows the form, does no processing
and closes. I am a newer programmer and probably haven't architected this
quite right.

Any suggestions?


Well, you haven't shown where you expect the actual processing to occur
in quiet mode. Do you need to show a UI at all? Why not just run the
processing and then quit?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: joe | last post by:
Hello, I have the following commands: testb -s <size> testb -s <size> -o <input file> testb -s <size> -o <codes> How do i split the commands so that all three are valid. And how do i check...
2
by: Mike D | last post by:
I use stored procedures in my asp using the connection object. I validate any inputs to protect myself from SQL injection. Why is it, or isn't it better to use the command object? I have used...
3
by: Eli Criffield | last post by:
I'm try run an ssh command in pexpect and I'm having trouble getting everything escaped to do what i want. Here's a striped down script showing what i want to do. -- #!/usr/bin/env python...
2
by: SunRise | last post by:
Hi I am creating a C Program , to extract only-Printable-characters from a file ( any type of file) and display them. OS: Windows-XP Ple help me to fix the Errors & Warnings and explain...
6
by: PAPutzback | last post by:
The process and execute methods want a path to the executable otherwise they kick out a file not found. So how can I execute the following. It works fine from a command window. echo password|...
3
by: Dubya | last post by:
Hello Everyone, I have this little app, that I would like to configure two modes of operation by using command line arguments. If the app is started with no arguments, the Main UserForm shows...
6
by: Dubya | last post by:
Hello Everyone, I have this little app, that I would like to configure two modes of operation by using command line arguments. If the app is started with no arguments, the Main UserForm shows...
16
by: John Salerno | last post by:
Here's my new project: I want to write a little script that I can type at the terminal like this: $ scriptname package1 where scriptname is my module name and any subsequent arguments are the...
13
by: Chris Carlen | last post by:
Hi: Having completed enough serial driver code for a TMS320F2812 microcontroller to talk to a terminal, I am now trying different approaches to command interpretation. I have a very simple...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.