Public Class Class1 Private objStatus As enuOperation_Type Public Enum enuOperation_Type ADDNEW UPDATE DELETE SEARCH NULL End Enum Public Sub New(ByVal Operation_Type As enuOperation_Type) MyBase.New() 'This call is required by the Windows Form Designer. ' InitializeComponent() 'ถ้าเป็น windows Form ใช้งานตรงนี้ 'Add any initialization after the InitializeComponent() call objStatus = Operation_Type End Sub End Class
2. การใช้งาน
Private Sub testEnum_CONSTRUCTOR() Try Dim objcls As New Class1(Class1.enuOperation_Type.ADDNEW) Catch ex As Exception Throw ex End Try End Sub