Solved

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

Posted on 2011-02-24
5
465 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
  • 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now