Help with Form class.

  • Thread starter Thread starter teejayem
  • Start date Start date
T

teejayem

This is kind of hard for me to explain so I hope you understand.

I have declared an object based on a class of a form I have designed.
This is declared at Class level within the frmMain class of my
project.

Dim frmErrors as New frmErrors

I have a method that shows the form

Sub

frmErrors.show

End sub

the problem I am having is if i close the form frmErrors down I can't
use this method again as the object has been disposed of.

You may ask why I don't just declare a new object based on the
frmErrors class within the method. This is because the form can't be
loaded twice.

Is there any way I can click the X on the form and it hide the object
rather than dispose of it?
 
This is kind of hard for me to explain so I hope you understand.

I have declared an object based on a class of a form I have designed.
This is declared at Class level within the frmMain class of my
project.

Dim frmErrors as New frmErrors

I have a method that shows the form

Sub

frmErrors.show

End sub

the problem I am having is if i close the form frmErrors down I can't
use this method again as the object has been disposed of.

You may ask why I don't just declare a new object based on the
frmErrors class within the method. This is because the form can't be
loaded twice.

Is there any way I can click the X on the form and it hide the object
rather than dispose of it?

Why not just replace:

frmErrors.Show()

with

If (frmErrors Is Nothing) Then frmErrors = new frmErrors()
frmErrors.Show()

Thanks,

Seth Rowe
 
Back
Top