Solved

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

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

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…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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…

803 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