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找出若干个数中最大的数
  • 天命奇御神器碎片怎么刷
  • 热门搜索
    新疆旅游路线 上海邮轮旅游 巴黎旅游 厦门旅游地图 万达文化旅游城 徐州旅游景点 日本旅游购物清单 浙江省旅游局 泰国旅游地图 阜阳旅游