Home > Net >  How to change the female form in child form the treeView node values
How to change the female form in child form the treeView node values

Time:09-15

The teacher is good, please comment:
Have a winform form, main form have a treeView, click the View1 and label1 loads respectively child form to panel1 (yellow area),
Now there are no methods, click for the child form (click label1 loading), can change the treeView form1 node characters, such as from "form1" to "test"

CodePudding user response:

Can directly access the parent form class controls, and then modify its data items;
Can also create a delegate in the parent form, in the child form through a call to modify the control data items entrusted by the way,

CodePudding user response:

Control object is a reference type, child form instantiation, the parent form treeView instance is passed to the child Windows to go,

CodePudding user response:

Simple point is the parent form when the parameters to the child form, so that you can visit the parent form controls in child form (set to access control to the public)

CodePudding user response:

If there is a reference variable a, you want to change the value of it? Amy polumbo rop=XXX? Of course, the premise is a within your current visit, that how can a by the current code access?
1, the local variable
2, the class fields
3, the public static variable
4, one can access the object of public attribute

So, when a is a treeView, you is to find a way to make a code you can access, the above four kind of means can be considered,

, of course, in addition to the changes in the form of a variable, you can also indirectly to do this, such as define events, events of code you can modify the treeview, also can use message loop, through messaging system modification parameters, can also define the intermediate variables, use a thread to monitor the intermediate variable, then make the corresponding modification,

And these, actually there is a corresponding concept, design patterns,

CodePudding user response:

Transfer object is a reference, so, you put the tree object or one of its item object is passed to the button in the context

CodePudding user response:

Advice to learn first vue, look at the people playing js how,

Play with js will tell, you display the template is a template, the data is the data, don't put together said,

Actually we here, too, same data is the data, display is, but you have been with slanting, can understand this is not much,

So, I suggest that you play first vue, playing for two weeks, the code in turn around and look at you now, you will find your code now how "disastrous"
  •  Tags:  
  • C#
  • Related