I was googling for a way to have my single form application start in the
same location on the screen it was in when it was closed. I found this
very short article: http://blogs.techrepublic.com.com/pr...lopment/?p=540
I can create the my.settings object as specified but I can't set the
form1's location to mainformlocatio n in form1's properties. It takes an
X and Y location.
Help! 22 4952
You are looking at the location property in the properties window. Go to the
very top of the properties window and expand 'Application Settings' then set
the location.
--
Terry
"cj" wrote:
I was googling for a way to have my single form application start in the
same location on the screen it was in when it was closed. I found this
very short article:
http://blogs.techrepublic.com.com/pr...lopment/?p=540
I can create the my.settings object as specified but I can't set the
form1's location to mainformlocatio n in form1's properties. It takes an
X and Y location.
Help!
Wow!, I'd never seen that before. Thanks! And the article works.
Terry wrote:
You are looking at the location property in the properties window. Go to the
very top of the properties window and expand 'Application Settings' then set
the location.
Terry,
Now here's a follow up. I have an app that I allow 2 instances of it to
be running on a pc at the same time. Folks usually like to spread them
out so they can see both at the same time. Will these settings allow
each instance to remember where it was? Or will this cause problems?
Terry wrote:
You are looking at the location property in the properties window. Go to the
very top of the properties window and expand 'Application Settings' then set
the location.
Well, not a big problem. They will both open in the last saved location.
And then they will have to move one. When they close the form, the settings
will be saved. So the last one closed, will be the setting that the next
one(s) use to start with.
--
Terry
"cj" wrote:
Terry,
Now here's a follow up. I have an app that I allow 2 instances of it to
be running on a pc at the same time. Folks usually like to spread them
out so they can see both at the same time. Will these settings allow
each instance to remember where it was? Or will this cause problems?
Terry wrote:
You are looking at the location property in the properties window. Go to the
very top of the properties window and expand 'Application Settings' then set
the location.
That's what I thought. As I detect which one is first and name it
instance A and the next one is named instance B perhaps it would work if
I made two entries in the project properties settings tab. Like
AMainFormLocati on and BMainFormLocati on then, then -- well shucks that
wouldn't help cause I don't actively control the saving of location.
It's no big deal. I've taken care of the programs that bothered me and
those don't. It was just a natural progression to wonder if it would
work for them too.
I'm not sure how all this works anyway. I guess the settings in the
project properties are saved by VB in the registry? Linking the setting
MainFormLocatio n to the location property of the application must keep
the values in both in sync. Am I on the right track?
As I said they do know which of them is A and which is B. I have first
thing in the form.load
objMutex = New System.Threadin g.Mutex(False, "AorB")
If objMutex.WaitOn e(0, False) = False Then
objMutex.Close( )
objMutex = Nothing
instance = "B"
Else
instance = "A"
End If
Well, if you know of an easy way to save location information for them
individually let me know but I don't have too much time to mess with it.
Thanks for all your help.
Terry wrote:
Well, not a big problem. They will both open in the last saved location.
And then they will have to move one. When they close the form, the settings
will be saved. So the last one closed, will be the setting that the next
one(s) use to start with.
Here is code designed to keep track of multiple form locations/sizes in the
same application. Instead of adding entries in Settings for each of the
forms in the application, you have 2 settings, location and size, and each
form uses its own settings object. You need an ApplySettings() call in the
Form Load event and a SaveSettings() call in the form closing event. In the
settings file have a formsize and a formlocation setting.
change the " Settings.Settin gsKey = Me.Name"
to something like Settings.Settin gsKey = Me.Name & Instance
I *think* that this will work.
Private ReadOnly Property Settings() As
System.Configur ation.Applicati onSettingsBase
Get
If _settings Is Nothing Then
_settings = New My.MySettings
End If
Return _settings
End Get
End Property
Private Sub ApplySettings()
Settings.Settin gsKey = Me.Name
Dim theSettings As My.MySettings
theSettings = DirectCast(Sett ings, My.MySettings)
If theSettings.For mSize <Drawing.Size.E mpty Then
Me.Size = theSettings.For mSize
End If
If theSettings.For mLocation <Drawing.Point. Empty Then
Me.Location = theSettings.For mLocation
End If
End Sub
Private Sub SaveSettings()
Settings.Settin gsKey = Me.Name
Dim theSettings As My.MySettings
theSettings = DirectCast(Sett ings, My.MySettings)
If Me.WindowState = FormWindowState .Normal Then
theSettings.For mSize = Me.Size
Else
' If the form was maximized or minimized,
' return to the restore state
theSettings.For mSize = Me.RestoreBound s.Size
End If
theSettings.For mLocation = Me.Location
Settings.Save()
End Sub
--
Terry
Thanks so much! It'll probably be the first of the week before I can
test it but I really appreciate it you sending me the code. Thanks!
Terry wrote:
Here is code designed to keep track of multiple form locations/sizes in the
same application. Instead of adding entries in Settings for each of the
forms in the application, you have 2 settings, location and size, and each
form uses its own settings object. You need an ApplySettings() call in the
Form Load event and a SaveSettings() call in the form closing event. In the
settings file have a formsize and a formlocation setting.
change the " Settings.Settin gsKey = Me.Name"
to something like Settings.Settin gsKey = Me.Name & Instance
I *think* that this will work.
Private ReadOnly Property Settings() As
System.Configur ation.Applicati onSettingsBase
Get
If _settings Is Nothing Then
_settings = New My.MySettings
End If
Return _settings
End Get
End Property
Private Sub ApplySettings()
Settings.Settin gsKey = Me.Name
Dim theSettings As My.MySettings
theSettings = DirectCast(Sett ings, My.MySettings)
If theSettings.For mSize <Drawing.Size.E mpty Then
Me.Size = theSettings.For mSize
End If
If theSettings.For mLocation <Drawing.Point. Empty Then
Me.Location = theSettings.For mLocation
End If
End Sub
Private Sub SaveSettings()
Settings.Settin gsKey = Me.Name
Dim theSettings As My.MySettings
theSettings = DirectCast(Sett ings, My.MySettings)
If Me.WindowState = FormWindowState .Normal Then
theSettings.For mSize = Me.Size
Else
' If the form was maximized or minimized,
' return to the restore state
theSettings.For mSize = Me.RestoreBound s.Size
End If
theSettings.For mLocation = Me.Location
Settings.Save()
End Sub
Missed one line, need to declare _settings right before the Private Readonly
Property Settings....
Private _settings as My.MySettings
--
Terry
"cj" wrote:
Thanks so much! It'll probably be the first of the week before I can
test it but I really appreciate it you sending me the code. Thanks!
Terry wrote:
Here is code designed to keep track of multiple form locations/sizes in the
same application. Instead of adding entries in Settings for each of the
forms in the application, you have 2 settings, location and size, and each
form uses its own settings object. You need an ApplySettings() call in the
Form Load event and a SaveSettings() call in the form closing event. In the
settings file have a formsize and a formlocation setting.
change the " Settings.Settin gsKey = Me.Name"
to something like Settings.Settin gsKey = Me.Name & Instance
I *think* that this will work.
Private ReadOnly Property Settings() As
System.Configur ation.Applicati onSettingsBase
Get
If _settings Is Nothing Then
_settings = New My.MySettings
End If
Return _settings
End Get
End Property
Private Sub ApplySettings()
Settings.Settin gsKey = Me.Name
Dim theSettings As My.MySettings
theSettings = DirectCast(Sett ings, My.MySettings)
If theSettings.For mSize <Drawing.Size.E mpty Then
Me.Size = theSettings.For mSize
End If
If theSettings.For mLocation <Drawing.Point. Empty Then
Me.Location = theSettings.For mLocation
End If
End Sub
Private Sub SaveSettings()
Settings.Settin gsKey = Me.Name
Dim theSettings As My.MySettings
theSettings = DirectCast(Sett ings, My.MySettings)
If Me.WindowState = FormWindowState .Normal Then
theSettings.For mSize = Me.Size
Else
' If the form was maximized or minimized,
' return to the restore state
theSettings.For mSize = Me.RestoreBound s.Size
End If
theSettings.For mLocation = Me.Location
Settings.Save()
End Sub
Pls help this humble newbie...
This thread looks like what I need but I'm having trouble following it.
Here's what I want to do- If the user moves the application to another place
on the screen, I want the app to appear there the next time it is run.
According to the link-
"I will use the Location property of the My.Settings object. Follow these
steps to access the My.Settings object:"
What is "My.Settings.Ob ject"? and where do I put it?
Thanks
ColsHub
"Terry" wrote:
Missed one line, need to declare _settings right before the Private Readonly
Property Settings....
Private _settings as My.MySettings
--
Terry
"cj" wrote:
Thanks so much! It'll probably be the first of the week before I can
test it but I really appreciate it you sending me the code. Thanks!
Terry wrote:
Here is code designed to keep track of multiple form locations/sizes in the
same application. Instead of adding entries in Settings for each of the
forms in the application, you have 2 settings, location and size, and each
form uses its own settings object. You need an ApplySettings() call in the
Form Load event and a SaveSettings() call in the form closing event. In the
settings file have a formsize and a formlocation setting.
>
change the " Settings.Settin gsKey = Me.Name"
to something like Settings.Settin gsKey = Me.Name & Instance
>
I *think* that this will work.
>
Private ReadOnly Property Settings() As
System.Configur ation.Applicati onSettingsBase
Get
If _settings Is Nothing Then
_settings = New My.MySettings
End If
Return _settings
End Get
End Property
>
Private Sub ApplySettings()
Settings.Settin gsKey = Me.Name
Dim theSettings As My.MySettings
theSettings = DirectCast(Sett ings, My.MySettings)
If theSettings.For mSize <Drawing.Size.E mpty Then
Me.Size = theSettings.For mSize
End If
If theSettings.For mLocation <Drawing.Point. Empty Then
Me.Location = theSettings.For mLocation
End If
End Sub
>
Private Sub SaveSettings()
Settings.Settin gsKey = Me.Name
Dim theSettings As My.MySettings
theSettings = DirectCast(Sett ings, My.MySettings)
>
If Me.WindowState = FormWindowState .Normal Then
theSettings.For mSize = Me.Size
Else
' If the form was maximized or minimized,
' return to the restore state
theSettings.For mSize = Me.RestoreBound s.Size
End If
theSettings.For mLocation = Me.Location
>
Settings.Save()
End Sub
>
>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Richard Walters |
last post by:
hi guys (and girls),
Does anyone know if there is a way to save the position of a form at
runtime. I am developing a small access application and the forms keep
reappearing in the preset position not where the users move them to. I know
you can change the centre property, move the form and then save it and it
will reopen in that position, but I would like to allow the users to choose
the locations of their forms. Is there a way of coding...
|
by: Scott |
last post by:
Is there an easy way of having a form auto sized to suit a particular screen
res?
Eg, If a package is designed using 1024*768 but someone want's to use it at
800*600 can it be automatically resized so all data is resized?
|
by: Patrick De Ridder |
last post by:
I have a form1. From it I can select form2.
Like so:
DataIO MyIO = new DataIO;
MyIO.Show();
I want MyIO to appear in a certain position on form1.
Say in position (0,0)
Which line of code would do the job?
|
by: barbara |
last post by:
Hi, all
I want to display two child forms in the MDI form at the same time and
set one particular one always on the top and another always on the
bottom. these two forms both have the same width as mdi and half
height of mdi(client area). how to do it?
Thanks!
|
by: Dennis |
last post by:
I have a form on which I have two controls, one docked to the left and the
other docked to the right in a window that is Maximized. I developed the
application on one computer which has a screen size of 1024 x 768. When I
run it on the other with 800 x 640, the right control doesn't resize to the
window maximized size but instead retains it's original size as per the IDE
with the 1024 x 768 screen.
How do I make it dock with "Fill" to...
| |
by: Franklin M. Gauer III |
last post by:
Hi,
We have an application running that uses FULL SCREEN ANCHORING in Windows
Forms. The application runs fine on all of our desktops and some laptops.
We are having problems with certain Dell laptops using an Nvidia Go graphics
driver (multi screen). When the app goes full screen - .NET does not detect
the right and bottom boundary of the screen - therefore all of the buttons
etc. that are anchored to either the right and/or the...
|
by: Bobby Edward |
last post by:
I have a long form. When I click the submit button at the bottom the page
does some validation. But, it always refreshes and the page is at the "top"
again. How can I have it "retain" it's scroll position?
I set the page directive of Enable View State to true but tht didn't help.
Thanks.
|
by: ridgedale |
last post by:
I have a test site setup at:
http://ridgedale.powweb.com/THS/sbx_index.php
and I am having trouble trying to resolve an issue relating to the scrolling navigation panel. When the user scrolls down the list and clicks on a link the new page is reloaded but the position in the navigation panel is forgotten and the content jumps to the top. :(
Is there any way to resolve this? Any assistance would be appreciated.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |