Hello,

One problem occured in my developed Mobile Application which has very
negative impact on the performance and is a very bad solution. I want to
explain my problem with an example because otherwise it is very difficult to
explain for me. My appication has a MainMenu were different Jobs are listed.
When I want to see further details to a certain Job I have to mark the
certain job and then the details would be displayed by the Details-Form. Now
I have implemented it in that way that every time the user chooses another
job to look for details a new Details-Form is created and displayed. But this
is a very bad solution. I tried it like in the MSDN article with a Global
class which contains an instance of every form and these instances are always
used if the corresponding form is needed. This works with the following code:

if(Global.details ==null)

{

Global.details = new Details();

}
Global.details.Show();

The problem with this technique is that when I choose a new Job in my
MainMenu the Details-Form is always displayed with the details of the
previous choosed Job. Thus the Global.details form is only displayed and not
modified in any way. Does anybody approximately know what I mean and know a
solution? :-/

Best Regards

patrick

Re: Windows Forms by Peter

Peter
Tue Dec 28 18:01:40 CST 2004

You need to expose a method or property on your Details form which will
allow you to set the values to be displayed. So for example if you have a
class called Job which has all the details of a specific job, you could
create a CurrentJob property on your Details form which would set up all the
controls to the details for that job e.g.

if(Global.details ==null)
{
Global.details = new Details();
}
Global.details.CurrentJob = thisJob;
Global.details.Show();

Then within the code in your Details form class, you would add code in the
CurrentJob setter to interrogate the properties of the assigned job and set
the values of your controls e.g.
txtJobName.Text = job.Name;

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

"pat" <pat@discussions.microsoft.com> wrote in message
news:A11EABEB-02B1-4972-848F-2816590027C5@microsoft.com...
> Hello,
>
> One problem occured in my developed Mobile Application which has very
> negative impact on the performance and is a very bad solution. I want to
> explain my problem with an example because otherwise it is very difficult
> to
> explain for me. My appication has a MainMenu were different Jobs are
> listed.
> When I want to see further details to a certain Job I have to mark the
> certain job and then the details would be displayed by the Details-Form.
> Now
> I have implemented it in that way that every time the user chooses another
> job to look for details a new Details-Form is created and displayed. But
> this
> is a very bad solution. I tried it like in the MSDN article with a Global
> class which contains an instance of every form and these instances are
> always
> used if the corresponding form is needed. This works with the following
> code:
>
> if(Global.details ==null)
>
> {
>
> Global.details = new Details();
>
> }
> Global.details.Show();
>
> The problem with this technique is that when I choose a new Job in my
> MainMenu the Details-Form is always displayed with the details of the
> previous choosed Job. Thus the Global.details form is only displayed and
> not
> modified in any way. Does anybody approximately know what I mean and know
> a
> solution? :-/
>
> Best Regards
>
> patrick