c# - Textbox controls created in child form is not selectable by mouse -


i have below situation in project.

class 'userform' derived windows.form class, has textbox control on it. instance of class 'userform' (userform1) created , shown. instance of 'userform' (userform2) created , parent set userform1 , shown.

i can select text in textbox control in userform1 using mouse. textbox control on userform2 doesn't allow selection of text using mouse or cursor cannot set using mouse. double clicking on control selects text. note can select text using keyboard though.

//mainform.cs namespace windowsformsapplication {     public partial class mainform : form     {         public mainform()         {             this.load += new eventhandler(mainform_load);             this.ismdicontainer = true;              this.size = new system.drawing.size(900, 600);         }          public void mainform_load(object sender, eventargs e)         {              userform userform1 = new userform();             userform1.text = "user form 1";             userform1.mdiparent = this;             userform1.size = new system.drawing.size(820, 465);             userform1.windowstate = system.windows.forms.formwindowstate.normal;             userform1.show();              userform userform2 = new userform();             userform2.toplevel = false;             userform2.location = new system.drawing.point(200, 100);             userform2.size = new system.drawing.size(820, 465);             userform2.text = "user form 2";             userform2.show();             userform2.parent = userform1;         }     } }  //userform.cs namespace windowsformsapplication {     public partial class userform : form     {         public textbox m_txtedit;          public userform()         {             initializecomponent();         }     } }  //userform.designer.cs namespace windowsformsapplication {     partial class userform     {         /// <summary>         /// required designer variable.         /// </summary>         private system.componentmodel.icontainer components = null;          /// <summary>         /// clean resources being used.         /// </summary>         /// <param name="disposing">true if managed resources should disposed; otherwise, false.</param>         protected override void dispose(bool disposing)         {             if (disposing && (components != null))             {                 components.dispose();             }             base.dispose(disposing);         }          #region windows form designer generated code          /// <summary>         /// required method designer support - not modify         /// contents of method code editor.         /// </summary>         private void initializecomponent()         {             this.components = new system.componentmodel.container();             this.autoscalemode = system.windows.forms.autoscalemode.font;             this.text = "form1";             this.windowstate = system.windows.forms.formwindowstate.maximized;             this.m_txtedit = new system.windows.forms.textbox();             this.m_txtedit.location = new system.drawing.point(5, 100);             this.m_txtedit.name = "m_txtedit";             this.m_txtedit.size = new system.drawing.size(149, 20);             this.m_txtedit.visible = true;             this.controls.add(this.m_txtedit);         }          #endregion     } } 


Comments