Windows Mobile window/form switching

HI all,
I have a program called DataPoint written in C# with Visual Studio 2005, that runs on Windows Mobile devices.  I have two main screens, Project and Main.  I frequently need to get to a separate program via the Start button, then return to the DataPoint Project screen. If I then tap the button to take me to the Main screen I end up back at the last screen from the other program.

Rather than attach all of the solution files, can I get some conceptual guidance?

Here is how I can repeat the problem in the emulator.
1. Open up the emulator.
2. Open up the Calendar (Start>Calendar)
3. Open up DataPoint and get past the splash screen so you are on the
Project screen
4. With DataPoint still open, use the Start button to get back to the
calendar (Start>Calendar)
5. Leave the Calendar open and return to DataPoint (Start>DataPoint)
6. You should still be on the Project screen and now either tap the Green
GoTo Veg button or the Veg button on the bottom options line to get to the Main screen.
7. You will be taken to the Calendar instead of the Veg/Main screen.
8. To get to the veg screen tap Start> then select DataPoint from the list
of recently opened items, otherwise go to Start>Programs and select
DataPoint there. You will be taken to the Veg screen.

So instead to going to the correct screen, it goes to the Last screen that was open.

phmurphyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hjgodeTier 3 Senior Technical Support EngineerCommented:
Hello

I am sorry, but I dont understand correctly.

If you like to switch to a specific window, use p/Invoke with FindWindow and ShowWindow (see pinvole.net). To run a specific app use System.Diagnostics.Process-Start (for example to start the calendar app).

I dont would go with using Start and then switch to the app you want.

Is Veg/Main another app or a form inside your main app?

regards

Josef
phmurphyAuthor Commented:
Thanks for your response.
Veg and Main are forms within the main app.  What is actually going on when I am collecting data is that I have to navigate to a location using GPS and a program called ArcPad, then when I get to a spot I need to collect vegetation data so I switch to DataPoint, fill in the project screen, then tap the goto veg screen and end up back at ArcPad instead.  Whatever program  that was running before I return to Datapoint is the one that the GoTo button sends me back to the first time I use it.  After I get to the Veg/Main screen via Start>DataPoint it works normally when switching back and forth between Project and Main.

I designed the DataPoint program and did some of the form layout work, but I have someone else do the actual C# programming.  They seem to be stumped with this issue so I am looking for some new approaches to the problem.
hjgodeTier 3 Senior Technical Support EngineerCommented:
Hello phmurphy

sounds like the programmers dont use form hide/show correctly.

I recommend to include an option in the main app to start/switch to ArcPad (see Process.Start and FindWindow/ShowWindow pinvokes).

Then in your main app provide a button to switch to ArcPad

When switching forms inside the main app, always use form.hide for the actual form and form.show for the form to show. Pseudo code:

OnButtonVeg{
formDatapoint.Hide();
formVeg.Show();
}

If you dont hide the actual form, it may happen what you describe, you switch to another app and back and get the wrong form presented by the compact framework runtime.

It may also a good choice to use modal forms, i.e. if you are in the Project Screen and need to enter veg data for the actual data, use FormVeg.ShowDialog(). This ensures the project screen is locked until FormVeg is closed (returns with a DialogResult constant).

regards

Josef

Please attach some screenshots (see MyMobiler freeware, if you dont know how), if you need further assistance.
phmurphyAuthor Commented:
Thanks for the comments, I paid a programmer and the way he got it to work is via f.owner code in C#.
I am going to close this issue.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
phmurphyAuthor Commented:
Got a solution from a paid programmer.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Smartphone Programming

From novice to tech pro — start learning today.