Share via

MessageBox Owner

OSVBNET 1,401 Reputation points
2022-06-30T10:14:24.92+00:00

Hello,
What to set for MessageBox.Show( owner? ) when calling it from a module?
I always use MessageBox.Show(Me, ...) but can't use it inside a module!
The module can be called from any form, so can't use a specific form name, unless I use startup form's name?
Thanks for the advise,

Developer technologies | VB
0 comments No comments

Answer accepted by question author

RLWA32 52,571 Reputation points
2022-06-30T11:28:01.063+00:00

If you're calling a function or sub in a module pass the owner window as a parameter.

For example,

Module Module1  
    Function Mbox(owner As IWin32Window, str As String)  
        Return MessageBox.Show(owner, str)  
    End Function  
  
End Module  
  

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Olaf Helper 47,621 Reputation points
    2022-06-30T10:35:05.017+00:00

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.