Problem with Form Close

Hello,

I've created a Form-Thread as follows:

private void ShowKeyboardForm()
{
keyboardForm = new KeyboardForm();
keyboardForm.ShowDialog();
keyboardForm.Focus();
keyboardForm.Dispose();
keyboardForm=null;
}

private void AnyFunction()
{
keyboardFormThread = new Thread(new ThreadStart(ShowKeyboardForm));
keyboardFormThread.Start();
}

And want to close it with the following code:

private void AnyFunction2()
{
keyboardForm.Close();
}

My problem is, that the form ONLY closes if I make any click on the form... it doesn't close itself.

Does anybody have an idea what the problem is? How can I simulate a click?

Thanks for your answer!

(I'm using Compact Framework 1.0)
[829 byte] By [skuehner] at [2007-11-19 19:30:58]