I have created a simple Application to notify a user of something that is happening. It consists of a single button that when a command line is passed to it, it will display that as the text property of the button. What I want to accomplish is that if no command line arguments are specified, it will display a default message. I'm new to C# so be gentle... Here is what i have so far.
private void Form1_Load(object sender, EventArgs e)
{
string[] passedinargs = Environment.GetCommandLineArgs();
if (passedinargs == null)
{
btnNotify.Text = "Please Start from Command Line";
}
else
{
btnNotify.Text = passedinargs[1];
}
When ran, this Execption is given:
An unhandled exception of type 'System.IndexOutOfRangeException' occurred in Notify.exe
with btnNotify.Text = passedinargs[1];
highlighted.
Any suggestions?