473,407 Members | 2,359 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,407 software developers and data experts.

how to set form startup location/position manually?

I am instnatiating a second form from a first form. I set startuplocation to
manual, then I enter 100 for X and 300 for Y on the second form. Then on the
click event of a button on form1 I have Dim frm = New form2, frm.Show. But
form2 shows up way to the right of the screen. I also tried this in code

frm.Location = New Point(100, 300)

but same results. How do you control the position of a form in VB.Net?

Thanks,
Rich
Nov 21 '05 #1
3 96840
"Rich" <Ri**@discussions.microsoft.com> schrieb:
I am instnatiating a second form from a first form. I set startuplocation
to
manual, then I enter 100 for X and 300 for Y on the second form. Then on
the
click event of a button on form1 I have Dim frm = New form2, frm.Show.
But
form2 shows up way to the right of the screen.


Make sure the form's 'StartPosition' property is set to 'Manual'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
Rich wrote:
I am instnatiating a second form from a first form. I set startuplocation to
manual, then I enter 100 for X and 300 for Y on the second form. Then on the
click event of a button on form1 I have Dim frm = New form2, frm.Show. But
form2 shows up way to the right of the screen. I also tried this in code

frm.Location = New Point(100, 300)

but same results. How do you control the position of a form in VB.Net?

Thanks,
Rich


Here is an example which might help...The child form is positioned in
relations to a CheckBox on the calling form. So no matter were the user moves
the form it is always were it should be in relation to the caller.

Dim f As New frmYourForm
Try
With f
.RunCode = True
.Location = Me.PointToScreen(New Point(CheckBox1.Left, CheckBox1.
Top + CheckBox1.Height))
.ShowDialog(Me)
End With
Finally
f.Dispose()
End Try

--
kevinDotSDotGallagherAtstateDotOrDotUs
Nov 21 '05 #3
Thank you all for your replies. I am setting StartPosition to Manual, and I
have tried the suggestions, but my form is still not behaving as desired. I
don't know if the following makes a difference, but the second form is
actually an indipendent form - not a child form (of an mdi form). One thing
I just noticed is this - if I set the startposition to CenterScreen or
CenterParent - the second form is not behaving as expected. The property is
being ignored. I only have 2 forms, so it is not like I am picking the wrong
form. If I set the primary form to CenterScreen - it appears on CenterScreen
as expected, but the second form does not behave as expected. Is there a
property I need to set/unset perhaps?

Thanks,
Rich

"Rich" wrote:
I am instnatiating a second form from a first form. I set startuplocation to
manual, then I enter 100 for X and 300 for Y on the second form. Then on the
click event of a button on form1 I have Dim frm = New form2, frm.Show. But
form2 shows up way to the right of the screen. I also tried this in code

frm.Location = New Point(100, 300)

but same results. How do you control the position of a form in VB.Net?

Thanks,
Rich

Nov 21 '05 #4

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

Similar topics

2
by: Kuba Glad | last post by:
Hi, I've spent some time using google, and reading basic manuals about Java Scripts and forms, but I can't find solution to this simple problem. In web page I want a such type of form like...
6
by: lauren quantrell | last post by:
I have a command button on a continuous subform and I want the user to click it to open a small popup form that opens in the position of the mouse (which is the same as the position of the command...
2
by: Geoff Jones | last post by:
Hi Can anybody tell me how to specify the startup location of an OpenFileDialog? Thanks in advance Geoff
2
by: Daniel | last post by:
Hi I have a datagrid on a web form and when a user double clicks on an item they are redirected to a details form. When they click on a link on the details form to return to the original form...
3
by: Rich Wallace | last post by:
Hi all, How can I load a form and display it in the lower right hand corner and have a 'docked' appearance to the system tray? TIA, -Rich
2
by: Tharpa Roberts | last post by:
I'm trying to make a button that will change the location of the form. I would have thought that the following code would do the trick: this.Location.X = this.Location.X + 1; however,...
8
by: Doc John | last post by:
I have an MDI container with a child Form which will be visible according to certain events. The problem is that when I set the property Visible to False and then back to True, the Form will be in...
0
by: ghickey | last post by:
I'm having problems with a windows form application that I am developing using C#.Net 2003. My application's layout gets altered when I transfer projects between the following two machines. ...
11
by: gumdealer328 | last post by:
I make a second form pop-up and hide the original form by pressing my Next button. How do I make the next form(s) that pop-up appear in the same coordinates as the original? This will make it look...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.