• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 492
  • Last Modified:

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

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
gbmcneil
Asked:
gbmcneil
  • 2
  • 2
1 Solution
 
rawinnlnx9Commented:
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
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
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
 
gbmcneilAuthor Commented:
Hello Idle -

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

As opposed to "Automatic"?
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
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
 
gbmcneilAuthor Commented:
Thanks again for your help.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now