-
Apr 13th, 2020, 07:29 PM
#1
Thread Starter
Hyperactive Member
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.
-
Apr 13th, 2020, 09:01 PM
#2
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?
-
Apr 14th, 2020, 12:33 AM
#3
Addicted Member
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.
-
Apr 14th, 2020, 11:52 AM
#4
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.
-
Apr 14th, 2020, 05:14 PM
#5
Thread Starter
Hyperactive Member
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
-
Apr 14th, 2020, 06:08 PM
#6
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
-
Apr 16th, 2020, 12:31 PM
#7
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|