Solved

Overflow when minimizing!

Posted on 2004-03-31
6
345 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 28

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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

 
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 28

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

828 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