Hi,

I strange thing is happening in my app. I have a main form (IsMdiContainer =True) containing a gridview, which when double clicking a record opens a form in Modal state containing a TabControl. When I close down form 2 and select another record, the form opens with the new data but with the last selected TabPage displayed. I would have expected the form to open "Fresh", so to speak.

Any ideas why, and what can I do?
Thanks,

How you are opening/closing the second form? post code.

How you are opening/closing the second form? post code.

To Open: MyForm.ShowDialog()
To Close: Me.Close()

First check this http://support.microsoft.com/kb/905719

When you issue Me.Close() the form still reside in the memory and the object inside it are still exist (not destroyed)

Try this
in the button that close the Dialog put this
Me.Close()
Msgbox(Me.Text) <-- this will give you the name of the of the form but you close it?

now try this

Me.Dispose()
MsgBox(Me.Text) <-- the Dispose will release the form and all it is object.

hth

First check this http://support.microsoft.com/kb/905719

When you issue Me.Close() the form still reside in the memory and the object inside it are still exist (not destroyed)

Try this
in the button that close the Dialog put this
Me.Close()
Msgbox(Me.Text) <-- this will give you the name of the of the form but you close it?

now try this

Me.Dispose()
MsgBox(Me.Text) <-- the Dispose will release the form and all it is object.

hth

Thanks,
That works fine. I thought Close() would do the same thing.

Glad that you solve your problem.

Could you please mark the thread as solved?

Have a nice day.

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.