How to i want to bind the static variable with textbox.. I tries following
public class AppStatus : INotifyPropertyChanged {
public static string conxStatus = "Disconnected";
public event PropertyChangedEventHandler PropertyChanged;
protected void NotifyPropertyChanged1(string propertyName)
{
if (this.PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
public string _conxStatus
{
get { return conxStatus; }
set
{
if (value != conxStatus)
{
_conxStatus = value;
NotifyPropertyChanged("conxStatus");
}
}
}
}
Form1
public partial class Form1 : Form
{
AppStatus sourceObject;
public Form1 ()
{
InitializeComponent();
sourceObject = new AppStatus();
this.textBox2.DataBindings.Add(new Binding("Text", sourceObject, "_conxStatus", false, DataSourceUpdateMode.OnPropertyChanged));
}
private void button1_Click(object sender, EventArgs e)
{
AppStatus.conxStatus = textBox1.Text;
}
}
Note:
Thanks in advance..