i am trying to test if a form is open or not, i thought the following was working:

if frmname.isdiposed = false then call frmname.somefunction

but it doesnt work like i thought it did

basically what im trying to do is determine if a form is open or closed, if its open call a function on the form. if it is closed don't do anything


thanks in advance.

Recommended Answers

All 6 Replies

does anyone know if frmmain.created = true will work?

How did initialized the form before calling the isdisposed() function?
Can you put it here the whole code of that function you are created.

i just use form1.show to initialize the form

You could use the following:

If Frmmain.Visible = False then
Frmmain.Show
Else
Call frmmain.function
End If

Find more at www.ITHelps.info

i was thinking of doing that, just wasnt sure if there was a better way or not.

i have been using the if form1.created = true then dowhatever

it seems to be working i may just stick with that not sure.
thanks for your input.

From the MSDN article:

Dispose will be called automatically if the form is shown using the Show method. If another method such as ShowDialog is used, or the form is never shown at all, you must call Dispose yourself within your application.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.