TextBox does not select the text when I click on the

1

I have an application that has a main form (frmPrincipal), within it there are several elements, one of them a groupbox, and this groupbox has been added as controls several forms (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 if you add the form to the groupbox it fails. The problem I have is that by doing this the TextBox contained in these forms does not work as they normally do, that is, if I click and drag the mouse, I should select all the text it passes through, but do 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 the forms that have the TopLevel to false, when you click and keep clicking, the cursor keeps blinking and when you drag 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 appreciate it very much,

Greetings.

    
asked by U. Busto 15.02.2017 в 16:14
source

2 answers

3

The problem seems to be some .Net bug. To fix it, you can add the following:

public frmClaves()
{
    InitializeComponent();
    this.FormBorderStyle = FormBorderStyle.None;
    this.SetTopLevel(false);
}

Or:

public frmClaves()
{
    InitializeComponent();
    this.ControlBox = false;
    this.Text = "";
    this.SetTopLevel(false);
}

That will make it work, although you will lose the title bar of the form. Although that you can simulate it by code in your form.

    
answered by 15.02.2017 / 16:37
source
0

the toplevel function, if I'm wrong, establishes that the text that contains the form is or is not selected, I suppose you will be enabling it from that form

You could use the use of MDI, Multiple Document Interfaces

link

link

link

    
answered by 15.02.2017 в 16:21