Welcome, Guest: Join Kenyans247 Log In!

Stats: 290 Members, 13,218 topics and 65 posts Date:  Thursday 22 October 2020 at 09:22 AM
Popular & Trending NewestFeatured Links ClassifiedDirectoryLivescoresLive Kenyan TVLive Kenyan Radio Follow Us Like Us

About Us Terms & Conditions Privacy Policy FAQ's Disclaimer Copyright Contact Us Advertise With Us Download K247 APP Marketplace Moderator Policy We Are Hiring Kenya Radio and TV Stations Listen and Watch Live Letter From the C.E.O Kenya Radio Stations Live Kenya TV Stations Live Kenya - Newspapers and News Sites and popular blog Forum Rules

Get Command Line Arguments in a Windows Forms Application

Kenyans247 / Science/Technology / Computers / Get Command Line Arguments in a Windows Forms Application

92 people viewed

Display A List Of Started Services From The Command Line (windows) Search For Install Packages From The Ubuntu Command Line Get Command Line Arguments In A Windows Forms Application Search For Install Packages From The Ubuntu Command Line
(Go Down) (» Reply topic)
Get Command Line Arguments in a Windows Forms Application by Kenyans247(1): Sun 22, March, 2020 10:22am
A useful technique for your applications is allowing them to parse command line arguments. This can give a lot of extra functionality to your application, for instance to pass the name of a file to open on the command line.

Most of the examples you’ll find online will show you something like this:

static void Main(string[] args)
{
foreach(string arg in args)
{
Console.WriteLine(arg);
}
Console.ReadLine();
}
That’s all fine and good, except that won’t work for our Windows Forms application without changing the type of the project to console, etc.

Thankfully, this is completely unnecessary, because you can simply do this:

string[] args = Environment.GetCommandLineArgs();

foreach(string arg in args){
// do stuff
}
And you can use this anywhere in your application, you aren’t just restricted to using it in the main() method like in a console application.

0 Shares 0 Like •

(» Go Up)

You must Sign in or Sign Up to post content

For you to post content on this website you have to log in or register, it only take few minute to create account

Go Up

Recommended for you

Kill Processes From The Windows Command Line Get Command Line Arguments In A Windows Forms Application Kill A Process By Process Name From Ubuntu Command Line Search For Install Packages From The Ubuntu Command Line

Currently: 1 guest(s) reading this article

Sections: Counties, Environment, Investment, Naija Forums, Family, Education, Innovation, Technology Market, Programing, Phones, Forum Games, K247 TV, Lifestyle, Theatre/Comedy, Social Media/K247 Chit-Chat, Tanzania Forum, South Sudan Forum, Ugandan Forum, Burundi Forum, Rwanda Forum,

About Us | Terms & Conditions | Privacy Policy | FAQ's | Disclaimer | Copyright | Contact Us | Advertise With Us | Download K247 APP | Marketplace | Moderator Policy | We Are Hiring | Kenya Radio and TV Stations Listen and Watch Live | Letter From the C.E.O | Kenya Radio Stations Live | Kenya TV Stations Live | Kenya - Newspapers and News Sites and popular blog | Forum Rules | Featured LinksFollow Us on TwitterLike Us on Facebook

Kenyans247 - Copyright © 2019 - 2020 Sande Kennedy. All rights reserved. See How To Advertise.
Disclaimer: Every Kenyans247 member is solely responsible for anything that he/she posts or uploads on Kenyans247.