• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 353
  • Last Modified:

Overflow when minimizing!

There are times when I have a Form floating above another form (vbmodeless).  The floating form does not have minimize/maximize/close enabled... (it's borderstyle is 0 / none).

When I attempt to minimize my application and keep the floating form visible, I get an overflow ('6') error.  Is there a way around this?

0
NO_CARRIER
Asked:
NO_CARRIER
  • 3
  • 2
1 Solution
 
ArkCommented:
Please show your main (minimized) form_Resize event code
0
 
NO_CARRIERAuthor Commented:
it's not the resize code that is the error... it's the Form_Activate code that is probably the culprit.  There are a number of fixed size forms in the application... when Form1 is closed and Form2 is shown, I want it to appear in the same screen co-ordinates.  So I save the current coordinates into 2 variables.. (SetTop & SetLeft) ... which are then called on FormLoad / FormActivate.

Form Activate()
    Me.Top = SetTop
    Me.Left = SetLeft
End Sub
0
 
NO_CARRIERAuthor Commented:
hmm... error is gone if i simply put On Error Resume Next ...
but that's not really good programming structure.  
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
sokolovskyCommented:
Check form state:
Form Activate()
 If Me.WindowState = vbNormal Then
    Me.Top = SetTop
    Me.Left = SetLeft
 End If
End Sub

But i think the problem is that SetTop or SetLeft have illegal data.
Form's property Top defined As Single, are you sure that SetTop returns Single?
0
 
NO_CARRIERAuthor Commented:
if windowstate=vbnormal on
Form Activate

and on Form Deactivate (Where it sets SetTop and SetLeft)

works fine... thank you!
0
 
ArkCommented:
This error occured since vbMinimized form can not resize (while vbMaximized can). IMHO, better solution is:
If Me.WindowState = vbMinimized Then Exit Sub
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now