Results 1 to 4 of 4

Thread: about message box

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2000
    Location
    Penang, Malaysia
    Posts
    51

    Wink

    How can i display a message box without any button (OK, YES, NO, Cancel, etc..) and it will disappear automatically?

    for example...a message box with the word "Pls wait..." when a program is loading

  2. #2
    Addicted Member
    Join Date
    Sep 2000
    Posts
    138
    The simplest and expensive way is to add a form with, perhaps, a timer.

  3. #3
    Guest
    I do my own forms. I've a form that has a Label usually named as Info.
    Info has autosize on, form is sizable toolbox, caption is empty.
    Then there's this code (in the form, in this example Form2):

    Code:
    Public Sub ShowMsg(Text As String)
        'Called when the form is not visible
        Dim NewWidth, NewHeight As Integer
        Info = Text
        NewWidth = Width - ScaleWidth + Info.Width + Info.Left * 2
        NewHeight = Height - ScaleHeight + Info.Height + Info.Top * 2
        Move (Screen.Width - NewWidth) / 2, (Screen.Height - NewHeight) / 2, NewWidth, NewHeight
        Me.Show
        Refresh
    End Sub
    I call it like this:

    Code:
    Private Sub Command1_Click()
        Call Form2.ShowMsg ("Please wait, loading...")
        'Some code
        Unload Form2
    End Sub
    You can't resize the window, because VB is doing something.
    This looks quite cool

    If you change this a bit, you can have icons, picture etc. in the message.

    Hope this helps,

    [Edited by MerryVIP on 10-19-2000 at 06:27 AM]

  4. #4
    Junior Member
    Join Date
    Aug 2000
    Posts
    27
    Try this:
    Code:
    Private Sub Form_Load()
    frmMain.Hide
    Load frmLoad
    
    ' Do your stuff
    DoEvents
    
    Unload frmLoad
    frmMain.Show
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width