473,573 Members | 4,449 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 32548
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
1739
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
2169
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...
1
1176
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...
5
1779
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...
3
2305
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
3539
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...
3
4751
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...
10
44069
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...
1
4486
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
7741
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, 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...
0
8167
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8028
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...
1
5550
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...
0
5252
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...
0
3692
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...
1
2164
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
1
1263
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
987
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...

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.