Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resizing Grid when Resizing Form

Status
Not open for further replies.

notrut

Programmer
Feb 6, 2002
87
0
0
CA
Hi,

How can you resize a grid to fit the size of a form when it is resized??

The width property of a form does not change when a form is resized?

How can I get the new width of a form after it has been resized??

Any help would be greatly appreciated!!
 

Yes the forms width does change and you can access and resize controls with the resize event of the form.

Good Luck

 
No it doesn't actually, unless I'm doing something wrong.

This does not work!!

Private Sub Form_Resize()

grdData.Width = frmGridUI.Width
'grdData.Refresh

End Sub
 

Here is a test for you...

In form load add the following two lines
[tt]
Me.Show
MsgBox "Load Event. My Width Is " & Me.Width
[/tt]
write that number down and in the resize event...
[tt]
MsgBox "Resize Event. My Width Is = " & Me.Width
[/tt]
Is that number different after you resize the form?

Also I see no error trapping in your resize event. You may want to add an error handler there.


Good Luck
 
1- Make sure 'frmGridUI' is the name of the form you are trying to resize.
2- If you are trying to resize vertically ONLY, the width will NOT change but the height property will. Where as in your code you are only assigning the width of the form.
3- In the resize event, try putting the code:

Debug.print "Form Height: " & Me.Height
Debug.print "Form Width:" & Me.Width

run the project and try to resize. you will see in the immediate window that the height and width properties do change. {W r i t e C o d e A n d K i c k A s s}
 
Thanks!!

When I used 'me' instead of frmGridUI it worked!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top