谁有现成的 Enum 结构的VB.NET例子
谁有现成的 Enum 结构的VB.NET例子,迫切等待着程序员高手来解答。 --------------------编程问答-------------------- 最简单的例子,呵呵Public Enum PlayType--------------------编程问答-------------------- 没听懂你的意思! --------------------编程问答--------------------
玩家0 = 0
玩家1 = 1
玩家2 = 2
玩家3 = 3
玩家4 = 4
End Enum
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim i As PlayType
i = PlayType.玩家0
'i = 0
MsgBox(i.ToString)
End Sub
是楼上所说的内容吗?
--------------------编程问答-------------------- 没能理解楼主要表达的意思 --------------------编程问答-------------------- 参考 --------------------编程问答-------------------- 2楼的就是枚举类型的实例啊!LZ好好学习一下! --------------------编程问答--------------------
--------------------编程问答--------------------
Imports System
Public Class EnumTest
Enum Days
Saturday
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
End Enum 'Days
Enum BoilingPoints
Celcius = 100
Fahrenheit = 212
End Enum 'BoilingPoints
<FlagsAttribute()> _
Enum Colors
Red = 1
Green = 2
Blue = 4
Yellow = 8
End Enum 'Colors
Public Shared Sub Main()
Dim weekdays As Type = GetType(Days)
Dim boiling As Type = GetType(BoilingPoints)
Console.WriteLine("The days of the week, and their corresponding values in the Days Enum are:")
Dim s As String
For Each s In [Enum].GetNames(weekdays)
Console.WriteLine("{0,-11} = {1}", s, [Enum].Format(weekdays, [Enum].Parse(weekdays, s), "d"))
Next s
Console.WriteLine()
Console.WriteLine("Enums can also be created which have values that represent some meaningful amount.")
Console.WriteLine("The BoilingPoints Enum defines the following items, and corresponding values:")
For Each s In [Enum].GetNames(boiling)
Console.WriteLine("{0,-11} = {1}", s, [Enum].Format(boiling, [Enum].Parse(boiling, s), "d"))
Next s
Dim myColors As Colors = Colors.Red Or Colors.Blue Or Colors.Yellow
Console.WriteLine()
Console.WriteLine("myColors holds a combination of colors. Namely: {0}", myColors)
End Sub 'Main
End Class 'EnumTest
Public Enum Inte易做图ceColors
MistyRose = &HE1E4FF&
SlateGray = &H908070&
DodgerBlue = &HFF901E&
DeepSkyBlue = &HFFBF00&
SpringGreen = &H7FFF00&
ForestGreen = &H228B22&
Goldenrod = &H20A5DA&
Firebrick = &H2222B2&
End Enum
补充:.NET技术 , VB.NET