🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #505

Re: VB 2005 EE -global declareations section

#505
From: Riki
Date: Tue, 17 Apr 2007 14:41
35 lines
2280 bytes
"Vito" <vito@home.fake> wrote in message 
news:U5qdnSsumNGN1XHYnZ2dnUVZ8v2vnZ2d@scarlet.biz...
> Hallo, ik zou een paar variablen als 'global' moeten declareren, 
> tistezegge: zodanig dat die kunnen bereikt en gewijzigd worden door alle 
> classen en ook alle forms in het project. Ik weet dat dit geen goede 
> programmeer-attitude is, maar voorlopig weet ik niet hoe het anders aan te 
> pakken ....
> Nu, hoe hard ik ook gezocht heb ... ik kan die 'global declarations 
> section' maar niet vinden en ik weet ook niet hoed dat allemaal te doen.
>
> Graag wat tips.
>
> Bedankt
>
> Vito

In dotnet is het idee om alles in objecten te doen. Dus:

Maak een klasse aan, en definieer je variabelen in die klasse als public 
static:

In VB.NET:

Public class Globals
     Public static pi As double = 3.14
     Public static title As string = "Mijnfirma"
End Class

Je kan ze dan overal aanspreken met
Globals.pi
Globals.title

--

Riki 
Technical Details
Message-ID: <B9adnY6IvavFQbnbnZ2dnUVZ8sKlnZ2d@scarlet.biz>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!bcklog2.nntp.dca.giganews.com!nntp.scarlet.biz!news.scarlet.biz.POSTED!not-for-mail
References: <U5qdnSsumNGN1XHYnZ2dnUVZ8v2vnZ2d@scarlet.biz>

Show Full Headers
Complete Article Headers
X-Google-Thread: fcea4,d385ad6eef726b2e
X-Google-Attributes: gidfcea4,public
X-Google-Language: DUTCH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!bcklog2.nntp.dca.giganews.com!nntp.scarlet.biz!news.scarlet.biz.POSTED!not-for-mail
NNTP-Posting-Date: Tue, 17 Apr 2007 09:40:24 -0500
From: "Riki" <laat@mij.gerust>
Newsgroups: be.comp.programming
References: <U5qdnSsumNGN1XHYnZ2dnUVZ8v2vnZ2d@scarlet.biz>
Subject: Re: VB 2005 EE -global declareations section
Date: Tue, 17 Apr 2007 16:41:46 +0200
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
X-RFC2646: Format=Flowed; Response
Message-ID: <B9adnY6IvavFQbnbnZ2dnUVZ8sKlnZ2d@scarlet.biz>
Lines: 37
NNTP-Posting-Host: 195.207.160.237
X-Trace: sv3-XKTsXxPhnzTHmc0kSC7/qNBl1OZsni+GNzonbmAaeWOnVPkUSQKM5ysjFM16mbCd9QAeg7ku/SinPoU!yJqXKIgiqV2ggMwx13Qx4yx6Kx9dndxyB7t7jAf+ipBChaulBhLTfMrUhSDkdJkm8sb8m2wxIWYH!6OZLr0nowvb9Zrs=
X-Complaints-To: abuse@scarlet.be
X-DMCA-Complaints-To: abuse@scarlet.biz
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.34