-4

How can I create a link between text boxes? I am working on my Accounting Project in which I have to link the multiple sheets and their data.

I am using multiple panels on a single from and there are many simple text boxes on my panels so the main thing I want here is that if I made change in one textbox it automatically updates the value of other textboxes linked with that.

halfer
  • 19,824
  • 17
  • 99
  • 186
  • This link may be helpful for you [clickhere](http://stackoverflow.com/questions/1806795/how-to-change-text-in-a-textbox-on-another-form-in-visual-c) – Udhay Titus Jun 22 '16 at 06:43

2 Answers2

1

Assume there are 4 textboxes. You can bind them as follows:

textBox1.DataBindings.Add("Text", textBox2, "Text", false, DataSourceUpdateMode.OnPropertyChanged);
textBox2.DataBindings.Add("Text", textBox3, "Text", false, DataSourceUpdateMode.OnPropertyChanged);
textBox3.DataBindings.Add("Text", textBox4, "Text", false, DataSourceUpdateMode.OnPropertyChanged);

Now when you change the text in any of them there will be changes in all.

Alexander Petrov
  • 13,457
  • 2
  • 20
  • 49
0

What do you mean automatically updates the value of other textboxes? There are no magic behind, just a code. So what you have to do is write some code. Call event on main text box OnTextChange and after that inside the function something like myTextBox1_OnTextChange() update the other control.

Gico
  • 1,276
  • 2
  • 15
  • 30