Sure. Let's assume your form is Form1 and the label you want to change based
on arguments is label1.
First you need to modify the static main method that studio geneted -
(in 2.0 this is in program.cs file, in 1.1 it's in the form1 itself).
Change:
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(fals e);
Application.Run(new Form1());
}
To:
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(fals e);
Application.Run(new Form1(args));
}
With that done overload the contructor of Form1:
public Form1(string[] args)
{
// Do Necessary Validations and Check before this line.
InitializeComponent();
label1.Text = args[0];
}
In other words - we take the arguments from Main - pass it to the forms
contructor and do whatever we want to do with the arguments in the forms
constructor.
I gave a quick test of this apporach on 2.0 - let me know if you're using
1.1 and have any problems.
Cheers,
rajiv.
"Jay" wrote:
I have a windows app that looks like a dialog box.
It displaya a message, with Yes/No buttons.
And the Message can be different each time the windows app is started.
Can I pass in the message as an argument into the windows app, so that I can
display that?