Why is it that on laptops with wide screens that my application screens show up on the right side of the screen and the user has to drag the screen into the middle. Is there a way to make the screen always show up in the middle of the screen?
Thanks for any help.
19 18537
I've noticed this too when working on my frontend on 2 monitors. Even though my forms are all set to centered, when I compile and distribute it, users have forms open up way off center, maybe relative to where I have them while developing. I think it has helped to make sure I open Acess in a regular size window, then open the forms and make sure they are centered there before I make the accdr (or mde). It seems really inconsistent though, and I haven't collected too much evidence.
@CD Tom
You can always make sure that Forms always show up in the 'Middle' of the Screen regardless of Screen Resolution or other factors, but the code is complex and involves judicious use of the API. If you are interested, I'll create a Demo DB that will illustrate this functionality for you.
That would be great, If you can just give me the code I can probable figure it out, unless it's easier doing the demo DB. Thanks
@CD Tom - Download the Attachment, it will make things a little easier.
- Within your Database, Import the FormInfo Class from the Demo Database. Almost the entire code functionality is encapsulated within this Class.
- In the General Declarations of your Form, declare a variable to represent the FormInfo Class, as in:
- In the Form's Load() Event, create a New Instance of the Class, set its Form Property to the Form where code is currently executing (Me), then Call the Center Method of the Class to Center the Form.
- Private Sub Form_Load()
-
Set mfi = New FormInfo
-
Set mfi.Form = Me
-
mfi.Center
-
End Sub
- Reposition the Form, and Click on the Command Button at any time to Re-Center it on the Screen.
- Disregard any related Properties, Methods, and Declarations from the FormInfo Class if they are not needed.
Thanks I'll let you know when I get everything working.
I've just got around to trying this and have a couple of errors. When I try and compile the program I get a error on Private mfi as formInfo the message is "Compile Error: A module is not a valid type" not to sure what to do next.
I was able to fix the first error but now I'm getting an on the the following line: .STATE = Val(Getsetting(appName, strName, adhcState, me.WindowState)) when I try and compile get an error on WindowState Compiler error: Method or data member not found" Got any ideas what's causing this.
Thanks, the program will run and the form does allign but the error comes up when I compile.
I ran the compile on your database and get the same error. Are we missing a ref or something?
@CD Tom
I'll look into it as soon as I get a chance.
@ADezii
WindowState is a Property of the FormInfo Class as evidenced by a pair of Property Let/Get Procedures contained within this Class. It appears as though a Variable has not been Declared as FormInfo, or that it has not properly been instantiated. Double-Check Steps 3 and 4 in Post #5, and make sure these Lines of Code are present exactly where they should be. Get back to me on this.
I've doubled checked everything and when I compile I still get the "Compile error Method or Data member not found. When I compile your database I get the same error.
@CD Tom
I'll call in some of my colleagues in on this one. If the problem can't be resolved, can you E-Mail me a Copy of your Database so that I may have a look at it?
Hi ADezii. Using A2003 I receive two error messages when I compile the code in the sample DB in post # 5. The compile errors both relate to the use of WindowState in class FormInfo.
The first error message relates to sub RetrieveCoords - method or data member not found.
.State = Val(GetSetting(AppName, _
strName, adhcState, Me.WindowState))
I wonder if the use of Me is incorrect here as WindowState is not a property of an Access form. There is a WindowState property of the form class available in .Net, however - as this MSDN link shows.
The second is in SaveCoords - expected variable or procedure, not enumerated type.
Call SaveSetting( _
AppName, strName, adhcState, WindowState)
Confusingly, there is a WindowState defined as an enumerated type in the class module (hence the error). Given the potential confusion over the .Net form class WindowState property I wonder if this was deliberate overloading on the part of the class designer?
-Stewart
@ADezii
Hello, ADezii.
Unfortunately module of FormInfo class doesn't contain "Get" part of WindowState property. Seems like the file you've attached is not the final working version. ;)
Regards,
Fish.
@CD Tom
Actually, both SaveCoords() and RetrieveCoords() methods could be thrown away if you don't intend to store form coordinates in windows registry.
That does take care of the Compile error and I don't intend to store form coordinates in the registry.
Thanks everybody for your help.
@ FishVal and Stewart, thanks guys for all your help, it is always appreciated. I've run this code on three different Access Versions, on three different PCs, and have had no problem. I'm more confused than ever. BTW, the base code was taken from the Access 2002 Desktop Developers Handbook, not exactly a 'shabby' source.
Back again and discovered my mistake. The DB that I Attached was only a subset of the actual Database which contained much more functionality in addition to the Center Form code. Obviously, in trying to make things more simple and compact, I've actually complicated everything and left a few things out in the process. Sorry for the run-around guys!
ADezii,
Can you send me the complete database I would like to see exactly what was causing the Compile error. I've removed the two sections and it seems to be working fine. Thanks for your help and also FishVal and Stewart.
@CD Tom
I will be more than happy to, but its size is beyond the limitation allowed for an Attachment. Simply send me your E-Mail Address in a Private Message (PM), and I'll send it to you that way. BTW, it is full of very interesting and functional code.
I've never sent a private message, have been looking around and don't see how it's done, sometime I really feel stupid.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: BuzzLight |
last post by:
This is my problem :-
- I have set a form frmSplash as the startup form instead of sub Main.
- This means I dont create an instance of it myself at startup.. its automatically created.
- I have...
|
by: BuzzLight |
last post by:
Thanks alot Charles m8, your suggestion was very useful, Iam very new to vb.net ... I used application.run and it works fine but I do not know what "Application.Run" means.. what it does..
But...
|
by: Ronald S. Cook |
last post by:
Can't make forms authentication for non-ASPX files work
In my web app, I want to secure not only .aspx files, but also .htm files.
From what I've read, I have to jump through some hoops to...
|
by: DBC User |
last post by:
I am wondering is there any way when I do a show and hide of a form, we
can do a smooth transition to the new screen like power point
presentation in c#??
Thanks.
|
by: den |
last post by:
if I want to open a popup at middle of screen in some example I see
that is used also Math.round;
is obligatory?
there are situation where the result of screen/2 if isnąt an integer can to
cause...
|
by: jlb |
last post by:
I am converting a VB6 app to .NET Visual Studio 2005. I have about 20 forms. Ths app starts with Main_form, and then passes to a "loop" of about 14 forms that pass from 1 to another, with the...
|
by: Shashi Sadasivan |
last post by:
Hi All,
i Have an application functionaluty which has 4 forms which are needed to interact by the user by dragging data from these forms to one another
the main form is located in the MDI Parent...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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...
|
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...
|
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,...
|
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...
|
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,...
|
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...
|
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...
|
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...
| |