Copy form within a project Right click on the source form > Copy Right click on the project > Paste Right click on the new form > Rename Change manually the class name in .cs Change manually the class and constructor name in .cs Change manually the class name in .Designer.cs
Category: Forms
.General Form Usage
Opening a form frmConfiguration ConfigForm = new frmConfiguration(); ConfigForm.PassedValue1 = "This is a string I'm passing"; //TO OPEN AS A DIALOG FORM: ConfigForm.ShowDialog(); //or if (ConfigForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) else if (ConfigForm.DialogResult == System.Windows.Forms.DialogResult.Cancel) //TO OPEN NOT AS A DIALOG FORM: ConfigForm.Show(); Closing a form Close(); //or this.Close(); Closing a form from the Form Load Event […]
Create New Form
Creating The Form Project > Add Windows Form. Name it using 'frm' at the start (our convention) Set the 'Form Border Style' Set 'MaximiseBox' and 'MinimizeBox' properties Set StartPostion Set 'Text' Set 'icon' (or turn off ShowIcon) Nice Things To Do Add this before the constructor public partial class frmMyForm : Form { //————————– //—– PUBLIC […]
Calling A Form Control Event
When you need to pass sender and e to the function (e.g. a form control event) frmMain_Load(this, new EventArgs());