473,396 Members | 1,892 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,396 software developers and data experts.

WindowState remaining Minimized despite being set to Normal

116 64KB
Hi.

I have a form that has the following code onload.

Expand|Select|Wrap|Line Numbers
  1. If Not My.Settings.MyLocation.IsEmpty Then
  2.     Me.Location = My.Settings.MyLocation
  3. End If
  4. If Not My.Settings.MySize.IsEmpty Then
  5.     Me.Size = My.Settings.MySize
  6. End If
  7. Me.WindowState = FormWindowState.Normal
  8.  
When the form is closed it decides if it should store the new size/location based on the following code.

Expand|Select|Wrap|Line Numbers
  1. If Me.WindowState = FormWindowState.Normal Then
  2.     My.Settings.MySize = Me.Size
  3.     My.Settings.MyLocation = Me.Location
  4.     My.Settings.Save()
  5. End If
  6.  
Every time I open the form it finds the correctly stored size of 1500,700.

However if the form was closed by right-clicking whilst it was minimised, it seems to ignore these settings and the requested Normal window state and remains minimised when loaded without any way to reinstate it.

This only seems to occur when the form is opened, minimised, closed whilst minimised then opened again. (Opening is done via a Show() command). The first loading seems to be ok.

Any ideas what on earth is going on and/or how to force the form to open at the stored size/location and normal state every time, no matter what state it was in when closed?

Thanks
Jan 5 '14 #1
1 1483
robertybob
116 64KB
Ok seems to be no straightforward answer so I'll post my solution here.

I had to hack around this by setting the WindowState to Normal immediately prior to closing so it always closes in Normal state.

It means the window briefly shows before closing but that's ok if there's no proper solution.
Jan 9 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Tai | last post by:
Hi all I have 2 forms, frmMain and frmChild. In frmMain, I declare a variable f as frmChid then Call f.ShowDialog() I want when the child form is minimized, the Main form is also minimized...
2
by: Tai | last post by:
Hi all I have 2 forms, frmMain and frmChild. In frmMain, I declare a variable f as frmChid then Call f.ShowDialog() I want when the child form is minimized, the Main form is also minimized...
1
by: Tai | last post by:
Hi all I have 2 forms, frmMain and frmChild. In frmMain, I declare a variable f as frmChid then Call f.ShowDialog() I want when the child form is minimized, the Main form is also minimized...
0
by: Steve McLellan | last post by:
Hi, Is there any problem programatically changing an MDI child form's WindowState fom Minimized to Maximized in one step? Setting to Maximized doesn't seem to do anything (setting it to Normal...
7
by: Colleyville Alan | last post by:
I have an app that uses Access to grab various PowerPoint slides using the followhyperlink command. I have set the PPT window to run in a minimized state: FollowHyperlink link Set oPres =...
2
by: Terry Olsen | last post by:
Using the below code, If I use Me.WindowState=Minimized the program runs fine, but you have the taskbar showing the program running. If I use Me.Hide instead, the program immediately exits. If...
4
by: mac | last post by:
Brand Newbie Alert! I am working through the "Build a Program Now!" book by Microsoft Press. The last chapter has a little app that should stay in the system tray when the user clicks on the 'X'...
6
by: =?Utf-8?B?QWxsZW4=?= | last post by:
When minimizing Visual Basic application, working memory is greatly reduced from about 20 MB to only about 2 MB. However I want the application to start as minimized, and most of the time it will...
2
by: =?Utf-8?B?UmljaA==?= | last post by:
using WinXp (SP3), VB2005. sometimes when a user opens the app - the app opens in minimized WindowState and clicking on the app's icon in the windows taskbar wont open the app to Normal...
2
by: z1freeride | last post by:
I'm wondering if there's a way to get the windowstate (maximized, minimized normal) of a process. For example: Process p = Process.GetProcessesByName("sample"); I would like to know if p is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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,...

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.