Child forms

  • Thread starter Perry van Kuppeveld
  • Start date
P

Perry van Kuppeveld

Hi,

When running this code, it's not possible to select the text using the mouse
in the textbox. What's wrong with it?
(This is just a code snippet. I can't use a MDI frame).

Regards,

Perry



using System;
using System.Drawing;
using System.Windows.Forms;

namespace WindowsTestApplication
{
public class MainClass
{
public class FormChild : Form
{
public FormChild()
{
TextBox tb = new TextBox();
tb.Location = new Point(5,25);
tb.Width = 240;
tb.Text = "Try to select a part of this text using the mouse";
this.Controls.Add(tb);
}
}

public class FormMain : Form
{
public FormMain()
{
FormChild f = new FormChild();
f.Location = new Point(10,10);
f.Size = new Size(250,150);
f.TopLevel = false;
this.Controls.Add(f);
f.Show();
}
}

[STAThread]
static void Main()
{
Application.Run(new FormMain());
}
}
}
 
T

Truong Hong Thi

Your are adding a Form as a control into another form which leads to
many subtleties. Any reason why not set it as a MDI child instead?

Thi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top