program
to demonstrate Enumeration concept using enum keyword.
-----------------------------------------code---------------------------------------------------------
-----------------------------------------output----------------------------------------------------
-----------------------------------------code---------------------------------------------------------
Imports System
Public Class Form1
Enum day
sunday = 1
monday = 2
tuesday = 3
wednesday = 4
thursday = 5
friday = 6
saturday = 7
End Enum
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Select Case TextBox1.Text
Case
1
MsgBox("sunday
is " & day.sunday & "
day")
Case
2
MsgBox("monday
is " & day.monday & "
day")
Case
3
MsgBox("tuesday
is " & day.tuesday & "
day")
Case
4
MsgBox("wednesday
is " & day.wednesday & "
day")
Case
5
MsgBox("thursday
is " & day.thursday & "
day")
Case
6
MsgBox("friday
is " & day.friday & "
day")
Case
7
MsgBox("saturday
is " & day.saturday & "
day")
Case
Else
MsgBox("invalid
number", , "message")
TextBox1.Text = ""
End Select
TextBox1.Text = ""
End Sub
End Class-----------------------------------------output----------------------------------------------------
codestrew |
codestrew |
No comments:
Post a Comment