473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Form SetDesktopLocation

I created the program below in VS2005. Form2 opens just fine, but it ignores
the call to SetDesktopLocation(). Any ideas why? It seems like a should be
trivial to specify a screen location where a Form2 would open.

Thanks...

//////////////////////////////////////

namespace TestDialogPosition
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.SetDesktopLocation(500, 500);
f2.ShowDialog();
}
}
}


Jun 27 '08 #1
2 3953
On May 1, 9:28*pm, randy1200 <randy1...@discussions.microsoft.com>
wrote:
I created the program below in VS2005. Form2 opens just fine, but it ignores
the call to SetDesktopLocation(). Any ideas why? It seems like a should be
trivial to specify a screen location where a Form2 would open.

Thanks...

//////////////////////////////////////

namespace TestDialogPosition
{
* * public partial class Form1 : Form
* * {
* * * * public Form1()
* * * * {
* * * * * * InitializeComponent();
* * * * }

* * * * private void button1_Click(object sender, EventArgs e)
* * * * {
* * * * * * Form2 f2 = new Form2();
* * * * * * f2.SetDesktopLocation(500, 500);
* * * * * * f2.ShowDialog();
* * * * }
* * }

}- Hide quoted text -

- Show quoted text -
If you jus want to set the start position of child form please try
this:

Form f2 = new Form();
f2.StartPosition = FormStartPosition.Manual;
f2.Location = new Point(500, 500);
f2.ShowDialog();
Jun 27 '08 #2
That works perfectly! Many thanks!

"Aneesh Pulukkul[MCSD.Net]" wrote:
On May 1, 9:28 pm, randy1200 <randy1...@discussions.microsoft.com>
wrote:
I created the program below in VS2005. Form2 opens just fine, but it ignores
the call to SetDesktopLocation(). Any ideas why? It seems like a should be
trivial to specify a screen location where a Form2 would open.

Thanks...

//////////////////////////////////////

namespace TestDialogPosition
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.SetDesktopLocation(500, 500);
f2.ShowDialog();
}
}

}- Hide quoted text -

- Show quoted text -

If you jus want to set the start position of child form please try
this:

Form f2 = new Form();
f2.StartPosition = FormStartPosition.Manual;
f2.Location = new Point(500, 500);
f2.ShowDialog();
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: John | last post by:
Dear all, It been more than 3 days I am trying to debug this program, I interpret it using activePerl and it is giving (perl -wc code_process.pl) no error syntax but when I put it online, change...
5
by: Richard Cornford | last post by:
I am interested in hearing opinions on the semantic meaning of FORM (elements) in HTML. I have to start of apologising because this question arose in a context that is not applicable to the...
1
by: Alexia | last post by:
Hi, just a quick question How do i make sure that the form shown is the size of my screen. i.e i want the form size to adjust to the resolution that is set on my monitor.
4
by: Targa | last post by:
Trying to total some price fields in a form but doesnt work when all the referenced form fields dont exisit. This is for an invoice - pulled prom a database and the form doesnt always contain the...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
19
by: Raposa Velha | last post by:
Hello to all! Does any of you want to comment the approach I implement for instantiating a form? A description and an example follow. Cheers, RV jmclopesAThotmail.com replace the AT with the...
30
by: VB Programmer | last post by:
Briefly, how do you save the current form to a jpeg or gif? Details: I have a form with a speedometer control on it. It continually loops through a table in a db that has different current...
2
by: Paul Mars | last post by:
How can I get the useable dimensions or coordinates of the working area of a form? All that I can find return the monitor screen area, but I need the usable area inside the open form. Not incl....
2
by: Cablewizard | last post by:
Ok, I have kind of a weird issue I haven't seen before. I am attempting to set the location of a new form to pop up in the same location as another. I have code similar to the following: Dim...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.