Re: globals?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




"Smokey Grindle" <nospam@xxxxxxxxxxxxxx> wrote in message
news:u8UQM8XQHHA.3440@xxxxxxxxxxxxxxxxxxxxxxx
:
: Whats the easiest way to make a global function in VB 2005? The
: old way was make a module, is that still the standard? thanks!


Try shared methods. These methods are available to every instance of a
type and can even be accessed without an actual instance being
declared (e.g.: the System.Console.WriteLine() method). It should be
noted that shared methods cannot operate on non-shared members of the
class. The following will not compile:

=========================================
Public Class [class]

Private i As Integer = 0

Public Shared Sub Method()
Console.WriteLine(i)
End Sub

End Class
=========================================


Ralf
--
--
----------------------------------------------------------
* ^~^ ^~^ *
* _ {~ ~} {~ ~} _ *
* /_``>*< >*<''_\ *
* (\--_)++) (++(_--/) *
----------------------------------------------------------
There are no advanced students in Aikido - there are only
competent beginners. There are no advanced techniques -
only the correct application of basic principles.


.



Relevant Pages

  • Re: globals?
    ... Whats the easiest way to make a global function in VB 2005? ... Try shared methods. ... Public Shared Sub Method() ... There are no advanced students in Aikido - there are only ...
    (microsoft.public.dotnet.languages.vb)
  • Re: globals?
    ... Be aware that it is not OOP, ... Try shared methods. ... Public Shared Sub Method() ... There are no advanced students in Aikido - there are only ...
    (microsoft.public.dotnet.languages.vb)