Solved

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

Posted on 2011-02-24
5
481 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 86

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 86

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

696 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