473,408 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Form.Show() acting weird

Hello,

I'm writing a reminders project and I've been having some difficulties.

It starts with a simple class that contains a timer and NotifyIcon, where
the main function initializes the timer followed by Application.Run();

Whenever the timer figures out it has to do something (pop a reminder) -
it creates an instance of the reminder window and calls the Show() method
of that form.

Now - what happens is that the form appears in the taskbar, but when you
click it, it stops responding. When I use ShowDialog instead, it runs OK.

Why can't I just show the form? Should I run it in a new thread?

Thanks in advance!
Nov 15 '05 #1
2 7353
Hi, Zzzbla:
According to the behavior, it seems to me the form doesn't participate
in the messageloop of application(since it is created in timer's thread).
It's better to do all the form related thing in the main thread. e.g. You
can implement creating and showing the form in one of form's eventhandlers,
then you trigger this event in Timer thread by calling through invoke, which
will notify the the main thread to do creating and showing.

Hope it helps!

Qiu
"Zzzbla" <b@man.com> wrote in message
news:MP************************@news.microsoft.com ...
Hello,

I'm writing a reminders project and I've been having some difficulties.

It starts with a simple class that contains a timer and NotifyIcon, where
the main function initializes the timer followed by Application.Run();

Whenever the timer figures out it has to do something (pop a reminder) -
it creates an instance of the reminder window and calls the Show() method
of that form.

Now - what happens is that the form appears in the taskbar, but when you
click it, it stops responding. When I use ShowDialog instead, it runs OK.

Why can't I just show the form? Should I run it in a new thread?

Thanks in advance!

Nov 15 '05 #2
hi!

It sounds weird but reasonable, that this is the problem... :)

Where can I learn more about invoke?

Thanks in advance!

In article <#p**************@TK2MSFTNGP12.phx.gbl>,

je**********@yahoo.com says...
Hi, Zzzbla:
According to the behavior, it seems to me the form doesn't participate
in the messageloop of application(since it is created in timer's thread).
It's better to do all the form related thing in the main thread. e.g. You
can implement creating and showing the form in one of form's eventhandlers,
then you trigger this event in Timer thread by calling through invoke, which
will notify the the main thread to do creating and showing.

Hope it helps!

Qiu

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: SpOiLeR | last post by:
Hello! I have a matrix class like this: class MyObject; // MyMatrix is contains MyObjects class MyMatrix { public: ...
0
by: sshuangw | last post by:
Hello: I am encountering a very weird issue with MDI child, Overriden WndProc function and hidden form. Basically, the application has two forms, Form1(parent form), Form2(Child form),...
4
by: Sebastian Bargmann | last post by:
Hi, I've run into a weird problem with the form designer. I have three classes: a messagebox class and two forms (Base and Derived which is derived from Base): (note: only relevant code...
4
by: Baz | last post by:
Hi. I'm new to this VB.Net mullarkey, and I must say it is proving to be a very trying experience. Here is the latest in a long line of problems: The Scenario ========= I am building an...
37
by: Geoff Jones | last post by:
Hi Suppose I have two forms: Form1 and Form2. I create and show an instance of Form2 in the code of Form1 e.g. Dim myForm2 = New Form2 myForm2.Show() How do I tell myForm2 that Form1 is...
7
by: Michael Erlewine | last post by:
I am trying to learn VB.Net and can't figure out how to call a from from another form. In VB6, I just issue a Load FormX, and an Unload FormX... and Show the form and there it is. I am sure it...
16
by: iwdu15 | last post by:
hi, i have a few forms in my project. when i load form1 (startup for) all is fine, then i open another one and use a login screen to call yet another and all is still fine, but then when i try to...
0
by: Miro | last post by:
Something I have run into using VB Express 2005 with mdi forms. I have not been able to re-create this but I'll let out the information on how I came about fixing this. As it cost me about 4...
9
by: Anil Gupte | last post by:
I have a MDI Parent Child set of forms FormContainer --MDIParent FormStart --MDIChild FormMain-->MDIChild FormSliceInfo-->MDIChild I use the following in the beginning of FomrContainer ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.