vb.net数组结构——枚举类型

 时间:2024-10-14 14:01:45

vb.net中的枚举数据类型

工具/原料

visual studio 2015

使用枚举类型

1、Record a DayAction of one of the following possible values:AsleepGetting ready for workTraveling to workAt workAt lunchTraveling from workRelaxing with friendsGetting ready for bed

vb.net数组结构——枚举类型

3、'Declare variablePrivate CurrentState As DayActionAdd the followi荏鱿胫协ng code below the variable you just added:'Hour propertyPrivate Property Hour() As Integer Get 'Return the current hour displayed Return dtpHour.Value.Hour End Get Set(value As Integer) 'Set the date using the hour passed to this property dtpHour.Value = New Date(Now.Year, Now.Month, Now.Day, value, 0, 0) 'Set the display text lblState.Text = "At " & value & ":00, Richard is " End SetEnd Property

vb.net数组结构——枚举类型

4、Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load 'Set the Hour property to the current hour Me.Hour = Now.HourEnd Sub

vb.net数组结构——枚举类型

6、执行结果入戏图所示:

vb.net数组结构——枚举类型

2、'Set the display text lblState.Text = "At " & value & ":00, Richard is " & CurrentState.ToString()End Set

vb.net数组结构——枚举类型
  • 逆水寒采木头攻略
  • 逆水寒梅鹤方盒怎么打开钥匙怎么获得方法
  • VB6.0找出若干个数中最大的数
  • 天命奇御神器碎片怎么刷
  • 热门搜索
    鱼片怎么做 快克感冒药 粗心大意的近义词 寻找的近义词是什么 害怕的近义词 佳能18-200镜头怎么样 年是怎么来的 消失的近义词 实践的近义词 怎么快速记忆