Link to home
Start Free TrialLog in
Avatar of MyAsylum
MyAsylum

asked on

**Resizing / Minimizing Form Problem**!!!!

Hi, I am currently working on a file-sharing program and am having a problem with the "Form_Resize" procedure of it.  I am using a TabStrip control and have set it to keep the same ratio of space to each side of the form. It works great when the form is maximized or normal or resized in any way. THE PROBLEM is when I minimize the form I recieve an error "Run-Time error '308', Invalid property value"  I have the following code so far. The error is between the arrows. When i take that portion of the code out, the minimize works fine, but i need that in somehow.    Ive also tried putting it in a separate function and calling it. ANY! solutions would be excellent!  If more information is needed to determine a solution to this, I will send anything! I am pretty new to programming. Thanks  -Dan

Private Sub Form_Resize()

    TabStrip1.Placement = tabPlacementTop
    TabStrip1.Style = tabTabs
   
 >>>   TabStrip1.Width = FrmPoodyDoo.Width - 3120    <<<
 >>>   TabStrip1.Height = FrmPoodyDoo.Height - 1350  <<<
         
    FRAME1(0).Width = TabStrip1.Width - 540
    FRAME1(1).Width = TabStrip1.Width - 540
    FRAME1(2).Width = TabStrip1.Width - 540
    FRAME1(3).Width = TabStrip1.Width - 540
    FRAME1(4).Width = TabStrip1.Width - 540
    FRAME1(5).Width = TabStrip1.Width - 540
    FRAME1(6).Width = TabStrip1.Width - 540
   
    FRAME1(0).Height = TabStrip1.Height - 1020
    FRAME1(1).Height = TabStrip1.Height - 1020
    FRAME1(2).Height = TabStrip1.Height - 1020
    FRAME1(3).Height = TabStrip1.Height - 1020
    FRAME1(4).Height = TabStrip1.Height - 1020
    FRAME1(5).Height = TabStrip1.Height - 1020
    FRAME1(6).Height = TabStrip1.Height - 1020
   
End Sub
ASKER CERTIFIED SOLUTION
Avatar of twalgrave
twalgrave

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
another alternate is check for the
frmPoodyDoo.Width and frmPoodyDoo.height so that when us substract the values it doesnt lead to a negative number. your code could be

if frmPoodyDoo.width>3120 then
   TabStrip1.Width = FrmPoodyDoo.Width - 3120
end if
if frmPoodyDoo.height>1350 then
   TabStrip1.Height = FrmPoodyDoo.Height - 1350
end if

in this way you will prevent the width and the height of the tabstrip from being assigned a -ve value and prevent the error.
hope this solves your problem.

(Nice form name I must say ;-))
Avatar of evanir
evanir

when u minimize the form, the form properties will change to:
form.width=2400
form.height=320
these are the values u get in the minimized state. So change ur tab strip width accordingto those values without making them into negative values.... which are causing the errors
Avatar of MyAsylum

ASKER

Thanks very much...it works great.    Thank you everyone else for submitting answers too! Im sure they worked but I guess I have to go with the person who submitted first.  "PoodyDoo".... soon to be the next best File-Sharing Software...watch for it! -Dan
Thanks Dan.  You do not have to select the person who submitted first.  You should always select the answer that works best for you.  During site cleanup, the usual recommendation is to select the first answer that answers the question fully, but if you are active in your questions, select what works best for you.  Hope this helps in the future. Have a great day.