Unable to place cursor after adding textbox control in windows form and adding form to panel control

2021-07-20T12:22:21.95+00:00

Hi,

Below are the steps to reproduce an issue.

  1. Created Form1.cs
  2. Added split container to Form1.cs
  3. Added panel to SplitContainer.Panel2
  4. Created Form2.cs
  5. Added three textbox controls to Form2.cs
  6. Added below lines of code

Form2 frm2 = new Form2();
frm2.TopMost = true;
frm2.TopLevel = false;
frm2.BringToFront();
frm2.Parent = panel1;
frm2.Show();

Initially cursor is at 0th position and when trying to place cursor in the middle using mouse, full text is getting selected. I am unable to place cursor on mouse click at specified position .

Developer technologies Windows Forms
{count} votes

1 answer

Sort by: Most helpful
  1. Daniel Zhang-MSFT 9,651 Reputation points
    2021-07-23T06:53:39.37+00:00

    Hi PatilNarayanaReddyCognizant-3509,
    I reproduced the problem through your description. This happens because you are displaying a form with a title bar.
    You need to remove the title bar from the form via following code:

    frm2.FormBorderStyle = FormBorderStyle.None;  
    

    More details you can refer to this thread.
    Best Regards,
    Daniel Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.