EmailViewerFrm is the form's name (like Form1). I notice that you are not calling the width by the Forms name like this:
Form1.Width Why is that? BTW, When I changed my code to remove the form name, everything worked fine...:-) Thanks! Tom Nesler -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Doug Hale Sent: Tuesday, November 24, 2009 3:37 PM To: [email protected] Subject: Re: [delphi-en] Resizing a form at Runtime This code works: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; const CustomerFlag = False;//True; type TForm1 = class(TForm) procedure FormShow(Sender: TObject); private public end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormShow(Sender: TObject); begin If CustomerFlag = True then Width := 864 else Width := 700; end; end. So, what is "EmailViewerFrm" and does it exist? Doug Nesler, Thomas J wrote: > I have a form that has two sets of controls. I would like to hide one > set when I start the form one way and another set when call the form > another way. What I would like to do is resize the form to hide the > controls when I call the form (showModal). Unfortunately, wherever I > place the code in my form calling routine I get an access violation. > > > > Can someone suggest the best way to do this? > > > > Here is my code: > > > > If CustomerFlag = True then EmailViewerFrm.Width := 864 > > else EmailViewerFrm.Width := 700; > > > > I tried calling this from the OnShow Event, the OnCreate Event, and the > OnActivate Event. > > > > Thanks in advance! > > > > Tom Nesler > > > > > > [Non-text portions of this message have been removed] > > > > ------------------------------------ > > ----------------------------------------------------- > Home page: http://groups.yahoo.com/group/delphi-en/ > To unsubscribe: [email protected]! Groups Links > > > > > ------------------------------------------------------------------------ > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.5.425 / Virus Database: 270.14.80/2523 - Release Date: 11/24/09 07:46:00 > > [Non-text portions of this message have been removed] ------------------------------------ ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [email protected]! Groups Links

