class CustomDataGridView : System.Windows.Forms.DataGridView{
public CustomDataGridView(DataTable dataSource) {
public CustomDataGridView(DataTable dataSource)
///Set the base data source to the passed //DataTable parameter
base.DataSource = dataSource;
}
Interface ISaveableControl{ void Save();}
class CustomTextBox : System.Windows.Forms.TextBox, ISaveableControl{ public CustomTextBox(string defaultValue) { base.Text = defaultValue; } public void Save() { ///Go to the database and update the associated record with the associated value }}class CustomComboBox : System.Windows.Forms.ComboBox, ISaveableControl{ public CustomTextBox(string defaultValue) { base.Items.Add(defaultValue); base.Text = defaultValue; } public void Save() { ///Go to the database and update the associated record with the associated value }}
foreach(Control ctrl in this.Controls){ if(ctrl is ISaveableControl) { ((ISaveableControl)ctrl).Save(); }}
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: