Click here to Skip to main content
14,739,420 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

Am working on a project on windows mobile 6 using C#.
In this application we have some screens. The user can navigate through these screens(forms).
We provided a back button functionality in each form's menu i.e if the user go to next form from the current form he is provided with a option to come back to previous screen.
This is working fine when the user is within that application environment, but whenever the user presses the end button provided on phone and comes back to our application he can seen the screen where he left at but when he clicks back option the application is getting disappeared.
Again when he opens the application the user is seen expected screen.
And this is happening until the user sees the initial screen of the application.

Can any one help me in solving this problem.

Thank You
Yashwanth.
Posted

So on application start, the last visited screen is shown. That is by intention. Right?

Pressing the "Back" button makes the applicaiton disappear. Let me interpret that as "application crashes without error message".

The application may crash because it tries to use a variable's value that is set to null.

Pressing the "Back" button will for sure use some variable lastVisitedPage or something similar. It may be of type Form12345. It will be set by going to the next page. But it is not set yet.

Check if it is different from null before you use it on button click.
   
Comments
YashwanthBathini 9-Sep-11 2:36am
   
Hi,
I have created some static instances of forms i have. On back button click event am calling formObj.ShowDialog(). Am getting an exception that "Value does not fall within the expected range." But when i use formObj.Show() the form is getting shown but am unable to access the controls on the form. Can you please help on this?

Thank You
Yashwanth.
You need this information, both after all the forms are filled out or when the application is ended and restarted.

1. Make a function that will be called whenever you go to a next screen or when the application ends. This function should save the data that is entered in the forms. Not sure how you do it on the mobile platform, but I suppose an XML file would be easiest. That's my expertise talking. Persist the data to a file or database, don't keep it in memory.

2. Whenever you go back, load the data from the file (or database). Whenever the app starts, the current tab should load the data from the file (or database).

Now you can go back or you can exit the app, without loosing precious data and without crashing (if you implement this correctly). Since I'm no great expert on mobile development (did some 3 years ago), I'll leave the implementation up to you. :)
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900