Home > Net >  Dynamically loaded label controls in the click event code execution result shows don't come out
Dynamically loaded label controls in the click event code execution result shows don't come out

Time:09-24

Questions as follows:
First through the code to the main form panel dynamic loading in the container label control, has carried on the binding to the click event of label control and processing code
Lb. MouseClick +=new MouseEventHandler (lb_MouseClick);//to dynamically loaded control binding MouseClick event

Public void lb_MouseClick (object sender, EventArgs e)
{
The Label lb=(Label) sender;
This. PanelMainModule. Visible=false;
This. PanelWork. The Dock=DockStyle. The Fill;
This. PanelWork. Visible=true;

//add module to the work list
TreeNode node=new TreeNode ();
Node. The Name=lb. Tag. The ToString ();//module FID as the key value of the node object
Node. The Text=lb. Text;
Enclosing tvwWorkList. Nodes. The Add (node);
//MessageBox. Show (this) tvwWorkList) Nodes. Count. The ToString () + "" + node. The Name. The ToString () +" "+ node. The Text).
}
Click on the TAB when testing, tracking operation process, process into the lb_MouseClick event, but to work in the list of Treeview control load node objects show not to come out, with messgebox test shows that the object has been loaded into the Treeview, with drag and drop the BTN control test, perform the same code loaded node objects, but to see another set of container control visible attributes also have no successful execution and showed the desired effect, please expert help, thank you.
  •  Tags:  
  • C #
  • Related