I have an application that has a main form (frmPrincipal), within it there are several elements, one of them a groupbox, and several forms have been added to this groupbox as controls (frmClaves, frmDatos,...). Each of these forms has several elements, including several textboxes. For the application to work correctly, the TopLevel property has been set to false.
public frmClaves()
{
InitializeComponent();
this.SetTopLevel(false);
}
This is necessary because otherwise adding the form to the groupbox fails. The problem I have is that when doing this the TextBoxes contained in these forms do not work as they normally do, that is, if I click and drag the mouse it should select all the text it passes through, but it does not select anything.
The funny thing is that in a normal textbox when you click and drag the mouse, the text is selected and the mouse cursor stops blinking, but in forms that have the TopLevel set to false, when you click and hold, the cursor continues blinking and when dragging the mouse there is no change.
If anyone knows how I can solve this or give the textbox of these forms the original behavior I would greatly appreciate it,
All the best.
The problem seems to be some .Net bug. To fix this, you can add the following:
O well:
That will make it work, although you will lose the title bar of the form. Although you can simulate that by code in your form.
If I am not mistaken, the function
toplevel
establishes that the text that contains the form is selectable or not, I suppose that it will be disabling it from said form.You could employ the use of MDI, Multiple Document Interfaces
https://msdn.microsoft.com/es-es/library/ms233676(v=vs.110).aspx
https://msdn.microsoft.com/es-es/library/ms229722(v=vs.110).aspx
http://www.ingenieriasystems.com/2013/11/Working-with-Interfaces-of-Multiple-Documents-MDI.html