Hey
I have already written a program that has a user interface, but I would like
to add some command line interface too. So if the user run it like:
program.exe paramater1
The program do something, but If not, the program normally run with windows
interface.
I tried Sub Main(args[] ... ) but I don't know how to connect it together.
Jarod 5 2167
Jarod <Ja***@discussions.microsoft.com> wrote: I have already written a program that has a user interface, but I would like to add some command line interface too. So if the user run it like: program.exe paramater1 The program do something, but If not, the program normally run with windows interface. I tried Sub Main(args[] ... ) but I don't know how to connect it together.
Are you writing in C# or VB.NET? This is a C# group, but Sub Main looks
very much like VB.NET...
Writing something with both a command line interface and a windows
interface is relatively tricky, I believe. I suspect there's a way to
write a console application and then have it "disconnect" from the
console if you're running it in Windows mode, but I don't know how
you'd do the disconnection.
To use command line parameters for your Windows app, just change the
signature of Main from
static void Main()
to
static void Main (string[] args)
and work from there.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
> Are you writing in C# or VB.NET? This is a C# group, but Sub Main looks very much like VB.NET...
Yeah it was mistake, because I also use a VB.Net. Writing something with both a command line interface and a windows interface is relatively tricky, I believe. I suspect there's a way to write a console application and then have it "disconnect" from the console if you're running it in Windows mode, but I don't know how you'd do the disconnection.
To use command line parameters for your Windows app, just change the signature of Main from
static void Main()
to
static void Main (string[] args)
and work from there.
But I have something like this:
I wrote a Windows form application, and now I need to add some command line
parameter. The problem is, when I use Main(...) the program executes only the
main, no windows form interface starts :( I need the program to execute
Main(...) and then to normaly run the windows up.
Jarod
Jarod <Ja***@discussions.microsoft.com> wrote: But I have something like this: I wrote a Windows form application, and now I need to add some command line parameter. The problem is, when I use Main(...) the program executes only the main, no windows form interface starts :( I need the program to execute Main(...) and then to normaly run the windows up.
You'll already have a Main method, which should include Application.Run
somewhere in it - just put your parameter handling stuff before the
call to Application.Run.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Hi,
As Jon's said it's tricky to live in both world, I tried it once, did not
work at the first try and I moved along, the solution I got was to have two
separated programs, one was the command line version, the other the windows
version, all the logic was implemented in a dll that both programs share so
no duplicated code ( only the config class that was copied verbatim )
If you need to go from command to win. app to could create a new process
and exec the win app. It should work fine.
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Jarod" <Ja***@discussions.microsoft.com> wrote in message
news:0F**********************************@microsof t.com... Hey I have already written a program that has a user interface, but I would
like to add some command line interface too. So if the user run it like: program.exe paramater1 The program do something, but If not, the program normally run with
windows interface. I tried Sub Main(args[] ... ) but I don't know how to connect it together. Jarod
Hi,
I'm a little confused, do you need to perform any input/output to the
console?
IF you do , then you have a problem ( see my other post)
IF you dont and all you need is to accept some parameters, perform some
action ( without using in any way the console ) and then create the form you
can do it using a windows app, just change the static void Main( ) to
static void Main( string[] args ) and remember that args[0] is the first
parameter, not the program being executed !!!
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Jarod" <Ja***@discussions.microsoft.com> wrote in message
news:5A**********************************@microsof t.com... Are you writing in C# or VB.NET? This is a C# group, but Sub Main looks very much like VB.NET... Yeah it was mistake, because I also use a VB.Net. Writing something with both a command line interface and a windows interface is relatively tricky, I believe. I suspect there's a way to write a console application and then have it "disconnect" from the console if you're running it in Windows mode, but I don't know how you'd do the disconnection.
To use command line parameters for your Windows app, just change the signature of Main from
static void Main()
to
static void Main (string[] args)
and work from there.
But I have something like this: I wrote a Windows form application, and now I need to add some command
line parameter. The problem is, when I use Main(...) the program executes only
the main, no windows form interface starts :( I need the program to execute Main(...) and then to normaly run the windows up. Jarod This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Joe |
last post by:
I'm using Python 2.4 on Windows XP SP2.
I'm trying to receive a command line argument that is a newline (\n)
Here is the command line to use
sample.py "\n"
Here is a sample.py script
|
by: Steve M |
last post by:
I'm trying to invoke a Java command-line program from my Python program
on Windows XP. I cannot get the paths in one of the arguments to work
right.
The instructions for the program describe the...
|
by: lkrubner |
last post by:
I'd like to write a PHP script to be used from the command line on a
Unix machine. I'd like for the script to put together a string, turn it
into a web page, print it, then return control the...
|
by: randyelliott |
last post by:
Good Day,
I have a MS Access (Access 2000 now upgraded to 2003) database that
tracks customer information. One function of this database is to
create an encrypted license file for our software,...
|
by: Roman Mashak |
last post by:
Hello, All!
I'm implementing simple CLI (flat model, no tree-style menu etc.). Command
line looks like this: <command> <param1> <param2> ... <paramN> (where
N=1..4)
And idea is pretty simple:
...
|
by: Double Echo |
last post by:
Hi all,
I'm using PHP 4.4.2, and use PHP on both the command-line and the web.
I am running PHP on SuSE 10 Linux , in a VMware 5.5 workstation, using
Apache 2.0.55 , on my Dell laptop. ...
|
by: Bit byte |
last post by:
I have a project that I normally build (without problems) from the
DevStudio IDE. However, I have embarked on automating all my builds
(this test project being one of several).
The project...
|
by: Jim |
last post by:
Hello,
I need a program that will traverse a directory tree to ensure that
there
are unix-style line endings on every file in that tree that is a text
file.
To tell text files from others I...
|
by: Ojas |
last post by:
Hi!,
I just out of curiosity want to know how top detect the client side
application under which the script is getting run. I mean to ask the
how to know whether the script is running under...
|
by: Jwe |
last post by:
Hi,
I've written a program which has both a command line interface
and Windows form interface, however it isn't quite working
correctly.
When run from command line with no arguments it should...
|
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...
|
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
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |