Hi all,
I have some class that's managing the user interface - CMan, and I'm passing it the struct array with some txtboxes in it. CMan than changes txtboxes.
This struct is initialized like this:
Problem is when I change txt box in CMan it doesn't reflect to myArray, so in the watch screen I have a following situation at the same time:
I've eliminated all the typo-errors, and am very puzzled right now... the TextBox isn't a value type, and when I assign it like that to another variable I can use it's properties with both variables (the target should be the same).... right?
(I guess I can solve it by using unsafe code via pointers, but I'd like to avoid this if possible)
I have some class that's managing the user interface - CMan, and I'm passing it the struct array with some txtboxes in it. CMan than changes txtboxes.
This struct is initialized like this:
Code:
struct STxt { public TextBox data1; public TextBox data2;};
STxt [] myArray;
myArray = new STxt[10];
myArray[0].data1 = txtFirstBox; //txtFirstBox is a TextBox
myArray[1].data1 = txtSecondBox;
//...
CMan handler = new CMan(myArray);
Code:
txtFirstBox.Text = "Sample text"; handler.TxtArray[0].data1.Text = "Changed text";
(I guess I can solve it by using unsafe code via pointers, but I'd like to avoid this if possible)
Comment