Solved

Overflow when minimizing!

Posted on 2004-03-31
6
342 Views
Last Modified: 2010-05-02
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
Comment
Question by:NO_CARRIER
  • 3
  • 2
6 Comments
 
LVL 27

Expert Comment

by:Ark
Comment Utility
Please show your main (minimized) form_Resize event code
0
 
LVL 1

Author Comment

by:NO_CARRIER
Comment Utility
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
 
LVL 1

Author Comment

by:NO_CARRIER
Comment Utility
hmm... error is gone if i simply put On Error Resume Next ...
but that's not really good programming structure.  
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 4

Accepted Solution

by:
sokolovsky earned 115 total points
Comment Utility
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
 
LVL 1

Author Comment

by:NO_CARRIER
Comment Utility
if windowstate=vbnormal on
Form Activate

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

works fine... thank you!
0
 
LVL 27

Expert Comment

by:Ark
Comment Utility
This error occured since vbMinimized form can not resize (while vbMaximized can). IMHO, better solution is:
If Me.WindowState = vbMinimized Then Exit Sub
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now