Hi Misbah
You need to check to see if the form is not nothing, meaning that it must be created if it is then use the bringtofront property, this will bring the form to the fore gound,if the form is nothing then create an instance of the form.
'if the form is equal to nothing or isdisposed then create it
If frmPart Is Nothing OrElse frmPart.IsDisposed Then
frmPart = New frmParts
frmPart.MdiParent = Me
frmPart.Show()
Else
'if form already open bring it to the fron
frmPart.BringToFront()
End If
the code is for a mdi app, to use in an sdi remove the mdiparent line
HTH Duncan
Duncan
|