Closing one form: Bring old form to front?

K

Kenny Rymes

Hello

I have a problem using .NET CF. If I open a new form with
"settings.showdialog" and I stay on the new form for 5-10 minutes, then the
old form disappears. If I close the settings-form, then I see the
Today-Screen instead of the old form.
Must be something with timeout...

I now tried to use this:

<DllImport("coredll.dll", EntryPoint:="SetForegroundWindow",
SetLastError:=True)> _
Public Shared Function SetForegroundWindow( _
ByVal hwnd As IntPtr) As Boolean
End Function
<DllImport("Coredll", CallingConvention:=CallingConvention.Winapi,
CharSet:=CharSet.Auto)> _
Public Shared Function FindWindow(ByVal lpClassName As String, ByVal
lpWindowName As String) As IntPtr
End Function
Public Shared Function BringFormToFront(ByVal FormName As String) As Boolean
Dim hwnd As IntPtr
hwnd = (FindWindow(Nothing, FormName))
SetForegroundWindow(hwnd)
End Function

after settings.showdialog I use:
BringFormToFront(me.text)

But this doesnt work either?!
Any solution to this problem?
Thanks
Kenny
 
T

TJ

It sounds more like a memory leak that is closing your other window. If
you show your settings window and then close it does your other window
still close after a few minutes? Have you tried running the program with
just the first window open for a few minutes to make sure it isn't
anything to do with the settings window?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top