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

Posted on 2003-02-24
Medium Priority
Last Modified: 2010-04-17
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
Question by:MyAsylum
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 16

Accepted Solution

twalgrave earned 140 total points
ID: 8013820
The problem is certainly with the width of the window.  You can fix this by putting a test in at the top of the resize like:

if  me.WindowState <> vbMinimized then ' might be FrmPoodyDoo instead of me becuase I don't know your environment
   .....your resize code

Expert Comment

ID: 8014169
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 ;-))

Expert Comment

ID: 8014296
when u minimize the form, the form properties will change to:
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

Author Comment

ID: 8028377
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
LVL 16

Expert Comment

ID: 8033729
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.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Suggested Courses
Course of the Month8 days, 5 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question