The 'owner' parameter to the MessageBox.Show() method is of type
IWin32Window. It does not represent a window handle, rather it represents a
window. so in your case it should be: rtn = MessageBox.Show(Me, "My
message").
The bigger point to understand when you read the documentation is that "You
can use the owner parameter to specify a particular object, which implements
the IWin32Window interface, to place the message box in front of.". Note the
use of the phrase 'in front of'. This means the position of the dialog in
the z-order, not the location of the dialog on the screen.
I have never understood how this parameter is useful. Because the dialog is
modal to the application, I can't see any point in displaying the dialog in
front of a window that might be behind the current window. One would have to
move the current window to see it but the dialog is modal so you can't.
"Ed Bitzer" <ed******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
One option of the messagebox object indicates it can be placed over a
selected window rather than just appearing centered on the desktop. The
function is "Overloads Public Shared Function Show(IWin32Window, String)
As DialogResult"
I have unsuccessfully tried:
///
Dim winhandle as string
Dim rtn as DialogResult
winHandle = Me.Handle.ToString()
rtn = MessageBox.Show(winhandle, "My message")
\\\
Unfortunately the winhandle becomes the content with the My message as the
title and the box in the center of the desktop, not over form1.
Appreciate some help.
Ed