Search This Blog

2010/01/17

Enum Creation in VB.NET:

Inside Form1 class:

Dim direction As Orientation

Public Enum Orientation As Integer
East = 1
West = 2
North = 3
South = 4
End Enum

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
direction = Orientation.North
TextBox1.Text = CStr(direction)
End Sub

Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
direction = Orientation.South
TextBox1.Text = CStr(direction)
End Sub

Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
direction = Orientation.East
TextBox1.Text = CStr(direction)
End Sub

Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
direction = Orientation.West
TextBox1.Text = CStr(direction)
End Sub

No comments:

Post a Comment