Solved

Overflow when minimizing!

Posted on 2004-03-31
6
344 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
ID: 10727653
Please show your main (minimized) form_Resize event code
0
 
LVL 1

Author Comment

by:NO_CARRIER
ID: 10727873
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
ID: 10727887
hmm... error is gone if i simply put On Error Resume Next ...
but that's not really good programming structure.  
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 4

Accepted Solution

by:
sokolovsky earned 115 total points
ID: 10728101
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
ID: 10728180
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
ID: 10728225
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

777 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