Aug 1, 2017 08:56 AM
(This post was last modified: Aug 1, 2017 09:00 AM by Marwix.)
I have 2 classes named Main_Menu and Final. "Main_Menu" contains a designer with components on it. The second one being "Final" is where I call "Main_Menu" because I need to retrieve the text from textBox1 in the first menu class.
Here's my question: Is there a way to get the updated text from textBox1 from the menu class? I'm pretty sure you can't but I wanted to see if anybody knows a solution to this.
Basically when I proceed to click on the button on the Final class form, it shows me the text from the menu class. However, whenever I change the textBox value it still shows me the original text that was in there before I changed it.
![[Image: 89b1a2ef6dfb44f80349c31c25911951.png]](https://i.gyazo.com/89b1a2ef6dfb44f80349c31c25911951.png)
And here is when I try to get the textBox value.
![[Image: 9e4bf7b1ab9381700d004c1beb5b1dc6.png]](https://i.gyazo.com/9e4bf7b1ab9381700d004c1beb5b1dc6.png)
It gets the value just fine but now before I close my form, I change the textbox1 value and retry clicking my button. This time even when textBox1 does not contain the text "exampleTest", it still decides to show me "exampleText". I understand why it does this but what im really asking for is a solution to actually get the updated text from this class and not the same text even when I changed it before closing my main Form1.
It would had been much easier if I had all components in one form because then I could just select the textBox and get the updated value no matter what I do, but in this project each tabpage has its own components and design structure which makes it a little bit difficult for me to get the updated text even if it shows me the original text.
Does anyone know how to solve this? If my get and set method was static and the textBox was also static then I could easily grab the textBox value straight away but as most of you guys know that's not possible since all components are declared as private.
Here's my question: Is there a way to get the updated text from textBox1 from the menu class? I'm pretty sure you can't but I wanted to see if anybody knows a solution to this.
Basically when I proceed to click on the button on the Final class form, it shows me the text from the menu class. However, whenever I change the textBox value it still shows me the original text that was in there before I changed it.
![[Image: 89b1a2ef6dfb44f80349c31c25911951.png]](https://i.gyazo.com/89b1a2ef6dfb44f80349c31c25911951.png)
And here is when I try to get the textBox value.
![[Image: 9e4bf7b1ab9381700d004c1beb5b1dc6.png]](https://i.gyazo.com/9e4bf7b1ab9381700d004c1beb5b1dc6.png)
It gets the value just fine but now before I close my form, I change the textbox1 value and retry clicking my button. This time even when textBox1 does not contain the text "exampleTest", it still decides to show me "exampleText". I understand why it does this but what im really asking for is a solution to actually get the updated text from this class and not the same text even when I changed it before closing my main Form1.
It would had been much easier if I had all components in one form because then I could just select the textBox and get the updated value no matter what I do, but in this project each tabpage has its own components and design structure which makes it a little bit difficult for me to get the updated text even if it shows me the original text.
Does anyone know how to solve this? If my get and set method was static and the textBox was also static then I could easily grab the textBox value straight away but as most of you guys know that's not possible since all components are declared as private.


![[Image: 9CDa97R.gif]](https://i.imgur.com/9CDa97R.gif)
![[Image: D12KBT6.png]](https://i.imgur.com/D12KBT6.png)