N
Nick Valeontis
code:
---------------- ---------------- ---------------- --------------------------------
----------------
namespace TestApp {
public partial class Form1 : Form {
private object s = "1";
public Form1() {
InitializeComponent();
Binding b = new Binding("Text", s, null, false,
DataSourceUpdateMode.OnPropertyChanged);
textBox2.DataBindings.Add(b);
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e) {
MessageBox.Show(" s = "+ s);
}
private void button1_Click_1(object sender, EventArgs e) {
//textBox2.DataBindings["Text"].ReadValue();
textBox2.DataBindings["Text"].WriteValue();
}
}
}
---------------- -------------------------------- --------------------------------
-------------------------------- -------------------------------- ----------------
problem:
-> textBox2.DataBindings["Text"].ReadValue();
works okay, value "1" is copied to the textbox.
However, if I change the value of the textbox to "5" and then try
textBox2.DataBindings["Text"].WriteValue(); nothing happens. When exiting
the form, s is still "1".
Have I misunderstood something?
---------------- ---------------- ---------------- --------------------------------
----------------
namespace TestApp {
public partial class Form1 : Form {
private object s = "1";
public Form1() {
InitializeComponent();
Binding b = new Binding("Text", s, null, false,
DataSourceUpdateMode.OnPropertyChanged);
textBox2.DataBindings.Add(b);
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e) {
MessageBox.Show(" s = "+ s);
}
private void button1_Click_1(object sender, EventArgs e) {
//textBox2.DataBindings["Text"].ReadValue();
textBox2.DataBindings["Text"].WriteValue();
}
}
}
---------------- -------------------------------- --------------------------------
-------------------------------- -------------------------------- ----------------
problem:
-> textBox2.DataBindings["Text"].ReadValue();
works okay, value "1" is copied to the textbox.
However, if I change the value of the textbox to "5" and then try
textBox2.DataBindings["Text"].WriteValue(); nothing happens. When exiting
the form, s is still "1".
Have I misunderstood something?