Re: Form level Public Variables

From: Jens Neuhalfen (JNeuhalfen_at_akkaya.de)
Date: 08/11/04


Date: Wed, 11 Aug 2004 12:47:25 +0200

Hi Ian.

(inline comments)

> Hi
>
> I was hoping some one could give me a good reason not to use Form level
> Public variables.

Its called "encapsulation" *g*. Use "Property Get" /"Property
Let|Set" as wrapper for the variables.

One reason is that your form is totally unaware of changes made from
the outside. This can be anything from a minor nuisance to major
crash scenarios with added timing problems - and you don't want
that, let me assure you.

The other reason is that you somehow need to shield your properties
- for example a negative "depth" (whatever you should need that for).

>
> I cant think of a reason why I shouldn't.
>
> The reason I want to use them is that I have a few almost generic forms in
> my application with a few subtle differences depending on how and when they
> are displayed.

Well, this is a good design.

>
> Now to me creating a form level variable that will accept an indicator as to
> how the form should be displayed is rather useful.
> And then the variable then becomes a property of the form.
>
> Ian

HTH

Jens

>
>



Relevant Pages

  • Re: Form level Public Variables
    ... Besides encapsulation though there is also the ... openMode As MyFileOpenConstant) ... >> I was hoping some one could give me a good reason not to use Form level ...
    (microsoft.public.vb.enterprise)
  • Form level Public Variables
    ... Public variables. ... I cant think of a reason why I shouldn't. ... Now to me creating a form level variable that will accept an indicator as to ...
    (microsoft.public.vb.enterprise)
  • Re: Is VC++ any "better" than C#?
    ... Well, that's an interesting example, if for no other reason than that the   ... understand to be a pretty good wrapper for DirectShow. ... unmanaged Windows API. ... in production code, regardless of whatever warnings come with it, with the   ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Is it possible to retrieve sent email message in Opennetcf?
    ... I can think of absolutely no reason, other than a contractual obligation to ... InTheHand, such as reading sent sms and sent email messages, will cost ... Do you think that its not worthiet to write the wrapper on my own? ... Paul G. Tobey wrote: ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Page Break in Excel from VB 2005
    ... I'm going to start to move the public variables. ... The reason I did not have the spreadsheet visible is because this program is ... having invisible copies of excel running if the project errored out. ... programming) is that of encapsulation. ...
    (microsoft.public.dotnet.languages.vb)