Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Form disappears when when msgbox is displayed? [modified]Can any one Answer this??????????

Form disappears when when msgbox is displayed? [modified]Can any one Answer this??????????

Scheduled Pinned Locked Moved Visual Basic
helpquestion
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mdrizwan_1
    wrote on last edited by
    #1

    I'm having a problem when using a msgbox on a second loaded form. I have two forms ... frmMain (default) and frmSecondary. When the program is run, frmSecondary will eventually be loaded and displayed as the active window (both are maximized, frmMain is still loaded in the background). Now, when a msgbox is used to advise the user of some occurence on frmSecondary, the frmSecondary disappears and frmMain suddenly appears behind the msgbox. Once the msgbox is clicked(i.e.,closed) the frmMain disappears (usually),and again reveal the frmSecondary. I would be grateful if someone could tell me why this is occurring. Note both the forms are border Style is set to None. Thank you.

    modified on Friday, January 8, 2010 5:06 AM

    L T O 3 Replies Last reply
    0
    • M mdrizwan_1

      I'm having a problem when using a msgbox on a second loaded form. I have two forms ... frmMain (default) and frmSecondary. When the program is run, frmSecondary will eventually be loaded and displayed as the active window (both are maximized, frmMain is still loaded in the background). Now, when a msgbox is used to advise the user of some occurence on frmSecondary, the frmSecondary disappears and frmMain suddenly appears behind the msgbox. Once the msgbox is clicked(i.e.,closed) the frmMain disappears (usually),and again reveal the frmSecondary. I would be grateful if someone could tell me why this is occurring. Note both the forms are border Style is set to None. Thank you.

      modified on Friday, January 8, 2010 5:06 AM

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Try

      MessageBox.Show(frmSecondary, "Hello World");

      Good luck :)

      I are Troll :suss:

      M 1 Reply Last reply
      0
      • L Lost User

        Try

        MessageBox.Show(frmSecondary, "Hello World");

        Good luck :)

        I are Troll :suss:

        M Offline
        M Offline
        mdrizwan_1
        wrote on last edited by
        #3

        Hello Eddy Vluggen, Its Vb6 application.

        L 1 Reply Last reply
        0
        • M mdrizwan_1

          I'm having a problem when using a msgbox on a second loaded form. I have two forms ... frmMain (default) and frmSecondary. When the program is run, frmSecondary will eventually be loaded and displayed as the active window (both are maximized, frmMain is still loaded in the background). Now, when a msgbox is used to advise the user of some occurence on frmSecondary, the frmSecondary disappears and frmMain suddenly appears behind the msgbox. Once the msgbox is clicked(i.e.,closed) the frmMain disappears (usually),and again reveal the frmSecondary. I would be grateful if someone could tell me why this is occurring. Note both the forms are border Style is set to None. Thank you.

          modified on Friday, January 8, 2010 5:06 AM

          T Offline
          T Offline
          Tom Deketelaere
          wrote on last edited by
          #4

          In what form do you call the messagebox? Is frmsecondary shown modal or not?

          M 1 Reply Last reply
          0
          • T Tom Deketelaere

            In what form do you call the messagebox? Is frmsecondary shown modal or not?

            M Offline
            M Offline
            mdrizwan_1
            wrote on last edited by
            #5

            Tom Deketelaere Its modaless form . Its bcoz i have set form border style to none.So i just wanna know why is causing problem with borderless form.

            1 Reply Last reply
            0
            • M mdrizwan_1

              Hello Eddy Vluggen, Its Vb6 application.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              I guess that the MsgBox is a form without a parent, and the MsgBox[^] method of VB6 doesn't have a parameter to set that. Without a parent, focus will be returned to the application, giving it's mainform the focus. Alternatively, you can call the MessageBoxA method from User32;

              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

              That goes into a module, and you can call it like this;

              MessageBox Me.hWnd, _
              "Caption", _
              "Text goes here", _
              vbExclamation

              Good luck :)

              I are Troll :suss:

              1 Reply Last reply
              0
              • M mdrizwan_1

                I'm having a problem when using a msgbox on a second loaded form. I have two forms ... frmMain (default) and frmSecondary. When the program is run, frmSecondary will eventually be loaded and displayed as the active window (both are maximized, frmMain is still loaded in the background). Now, when a msgbox is used to advise the user of some occurence on frmSecondary, the frmSecondary disappears and frmMain suddenly appears behind the msgbox. Once the msgbox is clicked(i.e.,closed) the frmMain disappears (usually),and again reveal the frmSecondary. I would be grateful if someone could tell me why this is occurring. Note both the forms are border Style is set to None. Thank you.

                modified on Friday, January 8, 2010 5:06 AM

                O Offline
                O Offline
                Oakman
                wrote on last edited by
                #7

                I'm certainly glad you modified your header to show how frustrated you are that no-one dropped what they were doing to provide you with the answer. Certainly all the time you have posted to help others should be a beacon to the rest of us.

                Jon "Fix reason firmly in her seat, and call to her tribunal every fact, every opinion. Question with boldness even the existence of a God; because, if there be one, he must more approve of the homage of reason, than that of blindfolded fear. " ~ Thomas Jefferson Soap Box 1.0: the first, the original, reborn troll-less

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups