474,116 Members | 4,600 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Messagebox location

I hope this is one of those simple questions that for some reason or another,
I'm just missing the obvious.

Using VB.NET 2003

I want my messagebox to display centered on the parrent form instead of the
desktop. The docs say to use

messagebox.show (owner as IWin32Window, ...

How do I obtain "owner" and successfully pass it as a parameter. Everything
I've tried either generates and error or simply results in the messagebox
centered on the desktop like always.

Thanks for any help

Nov 21 '05 #1
4 9880
Owner is the name of the form instance that the messagebox is supposed to
center itself on.

"Doug Robertson" <Do***********@ discussions.mic rosoft.com> wrote in message
news:71******** *************** ***********@mic rosoft.com...
I hope this is one of those simple questions that for some reason or
another,
I'm just missing the obvious.

Using VB.NET 2003

I want my messagebox to display centered on the parrent form instead of
the
desktop. The docs say to use

messagebox.show (owner as IWin32Window, ...

How do I obtain "owner" and successfully pass it as a parameter.
Everything
I've tried either generates and error or simply results in the messagebox
centered on the desktop like always.

Thanks for any help

Nov 21 '05 #2
"Scott M." <s-***@nospam.nosp am> schrieb:
Owner is the name of the form instance that the messagebox is supposed to
center itself on.


That's not true. Messageboxes are centered on the screen, not over the form
by default, even if an owner window is set.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
"Doug Robertson" <Do***********@ discussions.mic rosoft.com> schrieb:
I want my messagebox to display centered on the parrent form instead of
the
desktop. The docs say to use

messagebox.show (owner as IWin32Window, ...

How do I obtain "owner" and successfully pass it as a parameter.
Everything
I've tried either generates and error or simply results in the messagebox
centered on the desktop like always.


You will have to use a Win32 dialog hook to catch creation of the message
box and then set its position accordingly. Sample in VB6:

DialogPosition
<URL:http://dotnet.mvps.org/vb/samples/misc/DialogPosition. zip>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #4
While it may be true that message boxes center on the screen, it is also
true that "owner" is "The System.Windows. Forms.IWin32Win dow the message box
will display in front of." This comes directly from the VS.NET help.

ms-help://MS.VSCC.2003/MS.MSDNQTR.2004 APR.1033/cpref/html/frlrfsystemwind owsformsmessage boxclassshowtop ic12.htm


"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:eb******** ******@tk2msftn gp13.phx.gbl...
"Scott M." <s-***@nospam.nosp am> schrieb:
Owner is the name of the form instance that the messagebox is supposed to
center itself on.


That's not true. Messageboxes are centered on the screen, not over the
form by default, even if an owner window is set.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1639
by: Gerry Viator | last post by:
Hi all, Whats going on. Testing messagebox, text isn't showing up. Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code "
11
541
by: Rich Tasker | last post by:
I have a strange situation. A simple call to MessageBox.Show("XXX", "YYY") does not display the message in the messagebox with a visible font. Based on the content of the messagebox, the box sizes properly so I know there is a message in there. I also found a keyboard shortcut where <ctrl>+<insert> will copy the contents of the messagebox to the clipboard in plain text. I see my messagebox text in the clipboard contents but not in the...
2
30199
by: Dennis C. Drumm | last post by:
This is a restatement of an earlier post that evidently wasn't clear. I am building a custom MessageBox dialog that has, among other things, a few new button options (yes to all, no to all, etc.) and would like to make the dialog look and act like the standard MessageBox. Therefore, I would like to put in the message section the same type of icons found in the MessageBox dialog, such as MessageBoxIcon.Exclamation. In another post here I had...
0
518
by: zfeld | last post by:
Is there any way to specify where I want my MessageBox to show? It seems to always show up in the middle of the screen. Even when I use the MessageBox.Show Method (IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon) method and I pass in for the IWin32Window parameter my button on the form where I want it displayed. It probably makes sure it is not behind it as the documentation states: owner The IWin32Window the message box...
1
22285
by: M. Roming | last post by:
Hi together, I am trying to center a MessageBox based on the form wich is calling the Show method. This means: After calling the Show() method I don't want the dialog window in the center of the desktop instead I want it in the center of my form. I have already tried to pass the actual form object as a parameter to the Show() function with
1
1130
by: Gidi | last post by:
Hi, I finished writing my program, and i want to create an "about" messagebox, the thing is that i'm not sure that i should use the messagebox tool. what is the right tool to make an about window (and how does it done?), and how can i set it's location? thanks, Gidi
10
8324
by: Ed Bitzer | last post by:
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()
5
2352
by: jmelkerson | last post by:
In VB.Net 2005, is it possible to make MessageBoxes pop up somewhere other than centered on the Desktop? I develop on/for dual monitor systems and would like my MessageBoxes to not be split between the two physical monitors.
4
2564
by: kelvin.koogan | last post by:
I am having difficulty persuading MessageBoxes to appear over my application (using C++/CLI in VS2005). I would expect MessageBox::Show(this, "Some message"); to cause the message box to appear over the Form pointed to by this, but it doesn't seem to work, it appears centered on the screen. Any idea what I might be doing wrong?
0
10689
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10485
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
12369
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11748
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
11273
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8890
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
8051
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
5603
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
4171
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.