VB.Net Tutorial/Class Module/Public

Материал из VB Эксперт
Версия от 15:55, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Public Const

<source lang="vbnet">Imports System Module MyTest

 Sub Main()
   Console.WriteLine(Counter.MIN_COUNT)
   Console.WriteLine(Counter.MAX_COUNT)
   Dim input As Integer = 100
   if input < Counter.MIN_COUNT or _
      Input > Counter.MAX_COUNT Then
     Console.WriteLine("Value is out of acceptable range!")
   Else
     Console.WriteLine("The value " & input.ToString() & _
                       " is acceptable!")
   End If
   
 End Sub

End Module Public Class Counter

 Public Const MAX_COUNT As Integer = 500
 Public Const MIN_COUNT As Integer = 100

End Class</source>

100
500
The value 100 is acceptable!

Public members are available to anything that can instantiate this type

<source lang="vbnet">Public Class SomeClassInMyAssembly

   Public vPublic As Integer

End Class</source>