Re: Posting an event

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Trev Hunter (hunter_trev_at_hotmail.com)
Date: 02/15/04


Date: Sun, 15 Feb 2004 22:35:44 -0000


> But what if I want the message box to display immediately after my form
displays?

You could use the Activate event instead of the load event although you
would have to distinguish between the first time it is shown and times when
it is simply activated.

A better method would be to do the processing after you call Form.Show
(maybe with a call to DoEvents). E.g.

-------------------

Dim obJForm as new MyForm

objForm.Show
Application.DoEvents()
Messagebox.Show(........)

-------------------

If you could provide an explanation of what you're trying to accomplish, I
may be of more help. Also, try posting in the
microsoft.dotnet.framework.windowsforms group as this may be more
appropiate.

HTH,

Trev.

"Jeff Casbeer" <jeffcasbeer@hsi.com> wrote in message
news:0067C64C-27E7-4982-9443-4E3BAD8709CF@microsoft.com...
> Thanks Trev for your quick reply!
>
> I'm just trying to make a distinction between the Windows API options to
POST vs. SEND a Windows event. I'd really rather avoid trying to start a
new thread. I want the work to occur on this thread, just AFTER the
application returns to the Windows message handler and after Windows
processes anything else that entered the message queue before my POST. So,
for example, if I put a "MsgBox" in my form's load event, the message box
displays, then when I press OK the form displays. But what if I want the
message box to display immediately after my form displays?
>
> Is this not a valid technique with VB?
>
> Thanks - Jeff



Relevant Pages

  • Issues with adding/removing form load and closed events.
    ... and winfx beta 2. ... I added a windows form to the project and double clicked on it. ... error saying it could not find the load event. ... What's happening is double clicking on the form auto generates the form ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: attachment
    ... I can code a button to open the Windows "GetOpenFileName" dialog ... Private Sub CommFind_Click ... waiting until the Load event would work. ... Dirk Goldgar, MS Access MVP ...
    (microsoft.public.access.formscoding)
  • Using "Open With"
    ... I have developed a simple text editing program using Windows Forms. ... deal with them after capturing the Load event, or is there a different event? ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Problem closing down the application
    ... calling Application.Exit from the constructor, ... all application windows after the messages have been processed." ... Application.Exitin the ctor of the form still allows that form to be ... but the exception route (in either the constructor or Load event) works ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: global class (simple question!)
    ... singleton pattern should be used (this is thread safe variant): ... private static object sync = new object; ... I did this in the page load event: ... so the first time that I load this page, it should show "Hello World" and ...
    (microsoft.public.dotnet.framework.aspnet)