?
Solved

Visual Basic Show Message Box and NOT WAIT till user press ONE

Posted on 2007-12-05
6
Medium Priority
?
5,176 Views
Last Modified: 2013-12-20
Hello

I have a code like this:

Private Sub Form_click()
MessageBox 0, "Test", App.Title
Me.Caption = "HERE"
End Sub

I want me.caption = "HERE" to be called right after messagebox shown to user.

But now it waits till user press OK button in msgbox. I don't want to wait. Please advice about it. I tried MessageBox with APi, but still same.

I don't want to wait to user to press a button on messagebox, I just want to show messagebox and keep code running.

Thanks from now!
0
Comment
Question by:CSecurity
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 200 total points
ID: 20417694
Message boxes are modal dialogs, that means that it doesn't return the control to the calling function until it closes.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20417708
you can try to call directly the WinAPI's MessageBox() function:


Private Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
 
Sub Non_Modal_Msgbox(message as String, caption as String)
      Call MessageBox(0&, message, caption, 0&)
End Sub 

Open in new window

0
 
LVL 5

Expert Comment

by:abith
ID: 20417905
Then,When do you want messagebox to get disappear?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 48

Assisted Solution

by:jpaulino
jpaulino earned 400 total points
ID: 20418058
The better way to do that is to create your own msgbox. You have also some extended msgbox's examples that you can try to use  but it will give some work and I really don't know if it works.

http://vbnet.mvps.org/code/comdlg/messageboxex.htm
http://vbnet.mvps.org/code/hooks/messageboxhooktimerapi.htm
0
 
LVL 17

Accepted Solution

by:
wobbled earned 1400 total points
ID: 20418302
You could just create a userform and control that from a module.

eg. userform called frmMsg


In a module have the code

dim objFrm as object

set objFrm = new frmMsg

with objFrm
        .Caption = "Caption Text"
        .Show
end with

'more code

What you can do then is have a timer put on the form, this can then be called from the module to begin the timer and run it until it reaches a set number of seconds etc
This can then close the form and return you back to module of code

0
 
LVL 4

Expert Comment

by:J1H1W1
ID: 20418579
This would be a good point to start interopting with VB.Net code.  Then you could simply put the message box on a background worker thread.  To do the same in VB6 use the Windows API to start a new thread and call the message box from it.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question