473,909 Members | 4,189 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to resize form from code?

I would like to resize the height of a form through a piece of code. I
tried the following piece of code but got an error saying it was a read only
property and can't be set. Is there a was to resize the form at runtime?
Or is there a way to execute the command "Size to Fit Form" from the menu.

'Start of Code
Me.WindowHeight = fInchesToTwips( 2)
'End of Code

Thanks
Dustin Wilson
Nov 12 '05 #1
5 32602
On Mon, 9 Feb 2004 09:40:51 -0600, "Dustin Wilson"
<dw*****@REMOVE .kgsgroup.com> wrote:
I would like to resize the height of a form through a piece of code. I
tried the following piece of code but got an error saying it was a read only
property and can't be set. Is there a was to resize the form at runtime?
Or is there a way to execute the command "Size to Fit Form" from the menu.

'Start of Code
Me.WindowHeigh t = fInchesToTwips( 2)
'End of Code

Thanks
Dustin Wilson


You can use DoCmd.MoveSize for this purpose.

- Jim
Nov 12 '05 #2
"Dustin Wilson" <dw*****@REMOVE .kgsgroup.com> wrote in
news:IT******** *********@news1 .mts.net:
runtime? Or is there a way to execute the command "Size to Fit Form"
from the menu.


Private Sub Form_Load()
With DoCmd
.Restore
.RunCommand acCmdSizeToFitF orm
End With
End Sub

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #3
Lyle

Works perfectly. Exactly what I wanted. :)

Thanks
Dustin

"Lyle Fairfield" <Mi************ @Invalid.Com> wrote in message
news:Xn******** ***********@130 .133.1.17...
"Dustin Wilson" <dw*****@REMOVE .kgsgroup.com> wrote in
news:IT******** *********@news1 .mts.net:
runtime? Or is there a way to execute the command "Size to Fit Form"
from the menu.


Private Sub Form_Load()
With DoCmd
.Restore
.RunCommand acCmdSizeToFitF orm
End With
End Sub

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)

Nov 12 '05 #4
"Dustin Wilson" <dw*****@REMOVE .kgsgroup.com> wrote in message news:<IT******* **********@news 1.mts.net>...
I would like to resize the height of a form through a piece of code. I
tried the following piece of code but got an error saying it was a read only
property and can't be set. Is there a was to resize the form at runtime?
Or is there a way to execute the command "Size to Fit Form" from the menu.

'Start of Code
Me.WindowHeight = fInchesToTwips( 2)
'End of Code

Thanks
Dustin Wilson


To execute the Size to Fit Form command programatically ...

DoCmd.RunComman d acCmdSizeToFitF orm

--
Brendan Reynolds
Nov 12 '05 #5
Justin,

Try DoCmd.MoveSize, which will allow you to control the position of
the current window. if you are executing code in a the Form_Load
event, it should work OK. I haven't tried it on a subform, so I am not
sure how that would work.

If you are distributing your application, check out some of the
discussions on sizing as it relates to screen resolution. They may be
helpful, if that is what you are doing.

James Neumann
"Dustin Wilson" <dw*****@REMOVE .kgsgroup.com> wrote in message news:<IT******* **********@news 1.mts.net>...
I would like to resize the height of a form through a piece of code. I
tried the following piece of code but got an error saying it was a read only
property and can't be set. Is there a was to resize the form at runtime?
Or is there a way to execute the command "Size to Fit Form" from the menu.

'Start of Code
Me.WindowHeight = fInchesToTwips( 2)
'End of Code

Thanks
Dustin Wilson

Nov 12 '05 #6

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

Similar topics

2
1766
by: tom | last post by:
Hello, does anyone know if and how it is possible that when you use an image as backgroundimage of a form, this image adjusts itself when the form resizes. Sth. like 'StretchImage' for a picturebox. thanx, t
1
2182
by: guy | last post by:
Hi! we design forms in size of 800,600 because this is the size of our clients screen, the problem is that i can maximize the form from the control box or double click on the top border,to the size of my screen but i can't resize it from the edge of the form like we can do to any windows form. i have alot of application that i can do it there, i checked all thus application and every thing is the same. what can be the reason? thank's...
1
1190
by: Peteroid | last post by:
It looks like when I make a Form resizable and/or hit the maximize button that it shows garbage (unitialized memory) for the new portions of the form and then fills it in with background color. It only shows it very briefly, but it's VERY visible during this time. This happens with re-sizable forms too. And it 'feels' like re-sizing is 'jerky'; that is, lags a bit from my actions. I turn off visiblity to the controls on the form while...
5
1789
by: =?Utf-8?B?cm9nZXJfMjc=?= | last post by:
hey, how do I take form code and put it into separate classes? more specifically, I want to create like a panel class, and put buttons in it and give these buttons click events. and all my form has to show is the empty panel. then tell the panel to inherit from the panel class so it has all those buttons and click events... that way I can make like 10 panel classes, and when I want to display a panel, I just tell it to inherit from one of...
3
2321
by: monadel | last post by:
Hi guys, How do you resize a form in VB. Basically when user drag the form to minimise or maximise, it will resize all the components inside the form. thanks
3
3551
by: zacks | last post by:
I am developing an application in VS2005. I have a form that has a PictureBox control whose purpose is to be able to plop a User Control in it. And the User Control can be one of several possible User Controls and these User Controls are all different in size, some larger that the picture box it will be added to. How do I get the form to resize when I add a User Control to the picture box control when the User Control is larger than the...
3
4771
by: jkwok | last post by:
Hi, I have a form with two rich text boxes and two buttons. Some of the users want to be able to maximize and/or resize the form and have the rich text boxes resize to fit and the buttons always stay close to the right side border. Any tips on how I could do this? Maximizing and resizing have already been enabled. The effect now is that when you resize smaller, the text boxes and buttons go out of sight (depending on which side you resize...
10
44107
by: =?Utf-8?B?UmljaA==?= | last post by:
A lot of users at my workplace use different screen resolutions, and I build apps to use 1680 x 1050 pixels res by default. But some users are using 800 x 600, and the apps are too large for their screen. I used to write code in Java a few years ago (2005), and you could stretch a form with the mouse and all the controls and fonts would resize to larger or smaller size. Does .Net framework 3.5 support this kind of functionality? Or -...
1
4507
by: damicomj | last post by:
I have tried putting this code in mutiple spots: OnLoad, OnActivate, OnCurrent, OnResize. Neither seem to resize the form? Do I need to change one of the form's properties? I didn't see anything. Me.Width = "8"
0
9877
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,...
0
10538
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 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...
0
9725
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, 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...
1
8097
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7248
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5938
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...
0
6138
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3357
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.