Results 1 to 7 of 7

Thread: Form Icon and X button

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2017
    Posts
    500

    Form Icon and X button

    I'm experimenting with a Form to act as a MsgBox box so I set it's border property to 3-Fixed Dialog. I would like it to look the same as a regular MsgBox so how do I get rid of the icon and also make the X button disabled.

  2. #2
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: Form Icon and X button

    Setting the ControlBox property to False removes the Icon, but also removes the X/Close button instead of disabling it. Maybe that's close enough for your needs?

  3. #3
    Addicted Member
    Join Date
    Jun 2018
    Posts
    189

    Re: Form Icon and X button

    Set BorderStyle to (Fixed Dialog) and set the Icon property to (None). You can find API ways to disable the Close Button.

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Form Icon and X button

    FYI: Close button not disabled when the only button is the OK, i.e., vbOkOnly or the Cancel button is included, vbOkCancel, vbYesNoCancel
    Last edited by LaVolpe; Apr 14th, 2020 at 12:24 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2017
    Posts
    500

    Re: Form Icon and X button

    I considered the options but I decided to use a 2nd Form for the MsgBox. It works fine except it wont keep the focus even after trying frmMsgBox.SetFocus in the main Form that calls fmrMsgBox. It starts out with the focus but soon afterwards it goes grey and I have been unsuccessful to make it have the focus. Setting frmMsgBox.SetFocus doesn't seem to do anything.

    BTW: Does anyone know of a modaless MsgBox

  6. #6
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Form Icon and X button

    Even a modaless MsgBox wouldn't keep focus. I think the MessaeBox API will be modaless if you pass it a zero hWnd; been awhile, so not positive. In either case, if it's not modal, then it can lose focus.

    If you don't necessarily care about focus, but don't want your msgbox-form moving behind the main form, ensure you show it with the owner parameter, i.e, msgForm.Show , Me
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2017
    Posts
    500

    Re: Form Icon and X button

    I didn't think about using the .Show, Me option but I did use the always on top API. I'm assuming that since I can't keep the focus on the MsgBox-Form I wont be able to use hot keys for the Yes and No buttons

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