getting Main(string[] args) from Program.cs to Form1 : Form public string var1; ?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
How do I populate labels on a Windows Form after retrieving the input command args into the application?<br/>My code is below.<br/>Thank you,<br/>
<pre lang="x-c# using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace myNameSpace
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());

string valuesFromUIST = args[0].ToString();
MessageBox.Show("args[0] = " + args[0].ToString());
MessageBox.Show("args[1] = " + args[1].ToString());
MessageBox.Show("args[2] = " + args[2].ToString());

}
}
}

using System;
using System.Windows.Forms;

namespace myNameSpace
{
public partial class Form1 : Form
{
public string var1;
public string var2;
public string var3;
public string var4;

public Form1()
{
InitializeComponent();

}[/code]

View the full article
 
Back
Top