A form can't be moved or sized while minimized or maximized
Hi
I did a simply change in form_resize, now some machine run work fine , but other show the error
A form can't be moved or sized while minimized or maximized
Form_Resize
I changed
Code:
If Me.height < 6000 Or Me.width < 6000 Then
Me.height = IIf(Me.height < 6000, 6000, Me.height)
Me.width = IIf(Me.width < 6000, 6000, Me.width)
Me.Refresh
Exit Sub
End If
by
Code:
If Me.Height < 8550 Or Me.Width < 11430 Then
Me.Visible = False
Me.Height = IIf(Me.Height < 8550, 8550, Me.Height)
Me.Width = IIf(Me.Width < 11430, 11430, Me.Width)
Me.Refresh
Me.Visible = True
Exit Sub
End If
:confused::confused::blush::blush:
Re: A form can't be moved or sized while minimized or maximized
I guess this code runs inside a Form_Resize() Event, and you get the error when the Form is minimized.
So try;
Code:
Private Sub Form_Resize()
If WindowState <> vbMinimized Then
If Height < 6000 Then Height = 6000: Exit Sub
If Width < 6000 Then Width = 6000: Exit Sub
End If
'other code
''''''''''''
End Sub
Note:
1) The Exit Subs whenever we resize the form because the Resize Event will fire again re-entrantly when that happens.
2) The Me prefix to Form Properties is not normally required.
3) Form Refresh should not be required
Re: A form can't be moved or sized while minimized or maximized
Did you not find any of the subclassing-based solutions in your previous thread satisfactory? FYI, none of them is flicker-prone unlike the simplistic approach you've shown. ;)
Re: A form can't be moved or sized while minimized or maximized