473,394 Members | 1,813 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,394 software developers and data experts.

c# forms app WITH args? possible?

vs2005 pro
i have a c# windows forms based app that i need the ability to also start
from the run line (or command line) and pass args to. how can i do this?
Jul 13 '07 #1
4 7178
Check declaration of static Main method, where you run your main form . It
can have arguments for parameters.

Sample code:

class TestApp
{
static void Main(string[] args)
{
System.Console.WriteLine(args.Length);
}
}

HTH
Alex
"S Moran" <s@moran.comwrote in message
news:u4******************@TK2MSFTNGP06.phx.gbl...
vs2005 pro
i have a c# windows forms based app that i need the ability to also start
from the run line (or command line) and pass args to. how can i do this?


Jul 13 '07 #2
i need to write the args to a textbox on the form, but i cant access the
textbox from Main()
any ideas?

"AlexS" <sa***********@SPAMrogers.comPLEASEwrote in message
news:eX**************@TK2MSFTNGP06.phx.gbl...
Check declaration of static Main method, where you run your main form . It
can have arguments for parameters.

Sample code:

class TestApp
{
static void Main(string[] args)
{
System.Console.WriteLine(args.Length);
}
}

HTH
Alex
"S Moran" <s@moran.comwrote in message
news:u4******************@TK2MSFTNGP06.phx.gbl...
>vs2005 pro
i have a c# windows forms based app that i need the ability to also start
from the run line (or command line) and pass args to. how can i do this?


Jul 13 '07 #3
Hello,

you can use Environment.GetCommandLineArgs().

Kind regards,
Henning Krause

"S Moran" <s@moran.comwrote in message
news:eZ**************@TK2MSFTNGP02.phx.gbl...
>i need to write the args to a textbox on the form, but i cant access the
textbox from Main()
any ideas?

"AlexS" <sa***********@SPAMrogers.comPLEASEwrote in message
news:eX**************@TK2MSFTNGP06.phx.gbl...
>Check declaration of static Main method, where you run your main form .
It can have arguments for parameters.

Sample code:

class TestApp
{
static void Main(string[] args)
{
System.Console.WriteLine(args.Length);
}
}

HTH
Alex
"S Moran" <s@moran.comwrote in message
news:u4******************@TK2MSFTNGP06.phx.gbl. ..
>>vs2005 pro
i have a c# windows forms based app that i need the ability to also
start from the run line (or command line) and pass args to. how can i do
this?


Jul 13 '07 #4
Just pass arguments to form ar use advice of Henning Krause (Environment
call).
"S Moran" <s@moran.comwrote in message
news:eZ**************@TK2MSFTNGP02.phx.gbl...
>i need to write the args to a textbox on the form, but i cant access the
textbox from Main()
any ideas?

"AlexS" <sa***********@SPAMrogers.comPLEASEwrote in message
news:eX**************@TK2MSFTNGP06.phx.gbl...
>Check declaration of static Main method, where you run your main form .
It can have arguments for parameters.

Sample code:

class TestApp
{
static void Main(string[] args)
{
System.Console.WriteLine(args.Length);
}
}

HTH
Alex
"S Moran" <s@moran.comwrote in message
news:u4******************@TK2MSFTNGP06.phx.gbl. ..
>>vs2005 pro
i have a c# windows forms based app that i need the ability to also
start from the run line (or command line) and pass args to. how can i do
this?



Jul 13 '07 #5

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

Similar topics

6
by: Peter Kleiweg | last post by:
I'm still new to Python. All my experience with OO programming is in a distant past with C++. Now I have written my first class in Python. The class behaves exactly as I want, but I would like to...
10
by: Steven Bethard | last post by:
So, as I understand it, in Python 3000, zip will basically be replaced with izip, meaning that instead of returning a list, it will return an iterator. This is great for situations like: zip(*)...
0
by: wesley | last post by:
Hi all, I have been getting this frustating problem where my application keep throwing a NullReferenceException, but for the light of me I could not localise the location of the problem since it...
6
by: Kissingfish | last post by:
Hi there.. I'm trying to configure a quote form for my website.. I want to have different fields, for example radio buttons, check boxes and drop-down menus, and depending on what you select, a...
4
by: Mo | last post by:
Hi, I am writing a console application to send a key sequence to an old clunky application on a regular interval using the windows scheduler. I can get it to work if it is a windows form...
4
by: Jeremy | last post by:
I have a small block of code that uses DllImport tags to call methods in a dll written in C. I'm not sure how the dll works internally, but when I call some of these methods from a windows console...
1
by: TuckerRoth | last post by:
This is my first post on this site, so I don't know the rules. Please correct me if this gets to the wrong folks...etc. PROBLEM: Many of the apps that I am writing need to be able to run 2 ways:...
12
by: kronecker | last post by:
I found this nifty routine that closes a form one by one every time it is called. However, I need to hide them instead of closing them. Is there a way to alter the code? I assume it has something...
4
by: =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post by:
Hi, i have a main thread an another worker thread. The main Thread creates another thread and waits for the threads signal to continue the main thread. Everything works inside a ModalDialog and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
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,...
0
jinu1996
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...
0
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 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.