Solved

Launch a VB.NET dialogbox in a specific location from Namespace

Posted on 2011-02-24
5
475 Views
Last Modified: 2012-05-11
Hello Experts:

I am trying to show a startup dialog box in a specific screen location. The catch is that I am trying to do it from the Namespace of VB.NET.

Presently, my launch code is:

Application.MainForm = New frmHelloWorld

which works, but does not position the dialogbox in any particular location.  I have tried to change the code to the following, which includes some positional logic:

Dim db As New frmHelloWorld
db.Location = PointToScreen(New Point(4, 73))
db.ShowDialog()
 
But, it doesn't like "PointToScreen" which I thought was fair game in VB.NET.

Am I doing anything right here?

0
Comment
Question by:gbmcneil
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 9

Expert Comment

by:rawinnlnx9
ID: 34973367
There is not a lot out there on this topic. This is about as close as one can get I think: http://www.codeproject.com/KB/dialog/CenterDialog.aspx
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 125 total points
ID: 34973863
Set the StartPosition() to MANUAL:
Dim HW As New frmHelloWorld
            HW.StartPosition = FormStartPosition.Manual
            HW.Location = New Point(4, 73)
            Application.MainForm = HW

Open in new window

0
 

Author Comment

by:gbmcneil
ID: 34984878
Hello Idle -

Gee, that works great!  But, what does this mean, "FormStartPosition.Manual"?

As opposed to "Automatic"?
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 34985210
Instead of "Automatic" we have "WindowsDefaultLocation".

See FormStartPosition():
http://msdn.microsoft.com/en-us/library/system.windows.forms.formstartposition(VS.71).aspx

    Manual --> The position of the form is determined by the Location property.

    WindowsDefaultLocation --> The form is positioned at the Windows default location and has the dimensions specified in the form's size.

0
 

Author Closing Comment

by:gbmcneil
ID: 34985631
Thanks again for your help.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question