Passing In Arguments

It is possible to pass information to a windows form however you cannot use the Load Event for this.
The Load event does not allow arguments to be passed to it.


Constructor

This allows you to pass information into the form.
You can use a constructor which has the same name as the windows form.

protected string _passedIn; 

public Form1(string sValue)
{
   InitializeComponent()

   this._passedIn = sValue;
}


If you are using the constructor you can probably move any code from the Load event into the constructor.
So that all your initialisation code is in one place.



© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext