Not able to resize the form

there are two forms say form 1 and form 2 .

They are not vbmodal forms because if i make the forms as vbmodal then if i minimize the form 2 then form 1 is also minimized, but it should not be like this i.e. if form2 is minimized then form1 remains in maximize state.

So at the resize of each form this code is written so that the form comes in the center of the screen:

Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2

Form1 is the mainscreen and Form 2 opens on the click of a button which is on Form 1. When I try to minimize the Form2 an error comes :

RUN TIME ERROR : 384

A form can't be moved or sized while minimized or maximized.

pls help me out ......
[768 byte] By [ascom] at [2007-11-18 17:45:28]
# 1 Re: Not able to resize the form
You are trying to centre the form whilst at the same time minimising the form. You need a condition somthing like

if me.windowstate <> vbminimised then
DO your form centering here
end if
Bill Crawley at 2007-11-9 23:18:31 >
# 2 Re: Not able to resize the form
er, when you resize the form it jumps to the centre of the screen? just how irritating do you want your program to be? ;)
cjard at 2007-11-9 23:19:39 >
# 3 Re: Not able to resize the form
Originally posted by Bill Crawley
You are trying to centre the form whilst at the same time minimising the form. You need a condition somthing like

if me.windowstate <> vbminimised then
DO your form centering here
end if

:wave: thanks bill , i tried it and it worked properly.

by
ascom at 2007-11-9 23:20:38 >