Hi all,
1. I have two forms, FormA and FormB. There's a button on FormA that when click will brings up FormB. The trouble I have is When I maximize FormA (the parent form of FormB), FormB doesn't maximize with it. Please, help me on how to do that.
and another question!
2. How to let the user enter only numbers in a textbox and not letters
Thanks
Jason

Parent and child form maximize problem!!
XycsoscyX
I believe the MDI application type will give you the behaviour you want...
Andrej
saarar
Hi Andrej,
Thanks for the reply and the code, the textbox part works great, but I still have a question about the Forms part. How do I get FormB to move with FormA (the parent form) when it is moved.
Thanks
Jason
day10
Hi,
here's full code for FormA, hope it answers some of your questions...
public partial class FormA : Form{
FormB childForm;
public FormA()
{
InitializeComponent();
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
// Only allow numbers
int number;
string character = e.KeyChar.ToString();
if (int.TryParse(character, out number) == false && character != "\b")
{
e.Handled = true;
}
}
private void button1_Click(object sender, EventArgs e)
{
childForm = new FormB();
childForm.Show();
}
private void FormA_Resize(object sender, EventArgs e)
{
if (childForm != null && WindowState == FormWindowState.Maximized)
{
childForm.WindowState = FormWindowState.Maximized;
}
}
}
... put a button and a textbox on a form and wire appropriate events to make it work...
Andrej
kawano1h
Hi Andrej,
Thanks for your help, I took your advice about the MDI App. and it's work great now like the way I wanted. Again, thanks for your help. Greatly appreciated.
Thanks
Jason.