Skip to content

Instantly share code, notes, and snippets.

@devmnj
Created July 8, 2018 05:33
Show Gist options
  • Save devmnj/0a3491b1e031b1b88ffe379b1ee5ac83 to your computer and use it in GitHub Desktop.
Save devmnj/0a3491b1e031b1b88ffe379b1ee5ac83 to your computer and use it in GitHub Desktop.
Property Binding C#
public partial class Master: Form,INotifyPropertyChanged{
public Master()
{
InitializeComponent();
lbl_company.DataBindings.Add("Text", this, "Company");
}
private void pictureBox16_Click(object sender, EventArgs e)
{
ChildForm c = new ChildForm (); c.MdiParent = this;
ac.Show();
 
}
private string foo;
public string Company
{
set{
foo=value;
OnPropertyChanged("Company");
}
get { return foo; }
}
protected virtual void OnPropertyChanged(string property)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(property));
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
#endregion
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment