Weird form issue

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

I just thought I would post this to document it even though I've found a
workaround:

I was creating 2 forms like this:

dim f1 as new Form1
dim f2 as new Form2

f1.ShowDialog
f1.Close
f2.textbox.selectionlength = 1
f2.ShowDialog
f2.Close

Form2 has a textbox on it with 1 letter in it. For some reason, the text
was not being highlighted in this scenario. If I commented out showing
Form1, that fixed it.

When I removed the "new" in the dim statement for Form2 and created Form2
after Form1 was closed, it started working.

Weird.
 
I guess that might be because Form2 didn't get activated after Form1
is gone. You may confirm that after the weird situation appear, click
Form2 (outside the TextBox), and you might see the text highlighted.

A question is , why do you use ShowDialog(), instead of Show() ?

--
Best Regards,
Jan Yeh

MVP(Windows CE.NET), MCAD, .NETcf Developer & Consultant
Mobile Mind Co., Ltd. @ Taiwan
 
Why wouldn't it get activated? No, clicking on the form doesn't change
anything - text still doesn't show as highlighted.
I am using ShowDialog() because I want the forms to show modally.
 
Hi, Mike

How does it act if you use Show() ? Does the same problem occur?

If you don't want user to navigate between forms, you can use
Form2.Show()
Form1.Hide()
to keep only one form appear.

--
Best Regards,
Jan Yeh

MVP(Windows CE.NET), MCAD, .NETcf Developer & Consultant
Mobile Mind Co., Ltd. @ Taiwan
 
Back
Top