Public Class Category
    Private Sub Category_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        LoadCategory()
    End Sub

    Private Sub Category_Resize(sender As Object, e As EventArgs) Handles MyBase.Resize
        cbxCategory.Left = 0
        cbxCategory.Width = Me.Width
    End Sub



    Private Sub LoadCategory()
        If (Me.DesignMode = False) Then

            Dim tblCategory As DataTable = DB.GetData("select Category_Number , Category_Name from Category")
            cbxCategory.DataSource = tblCategory
            cbxCategory.ValueMember = "Category_Number"
            cbxCategory.DisplayMember = "Category_Name"
        End If
    End Sub

    Public Function GetItems() As ComboBox
        Return cbxCategory
    End Function

    Public Function IsSelected() As Boolean
        If cbxCategory.SelectedIndex < 0 Then
            Return False
        Else
            Return True
        End If
    End Function


    Public Function GetIndex() As Integer
        Return cbxCategory.SelectedValue
    End Function

    Public Function GetValue() As Object
        Return cbxCategory.SelectedValue.ToString()
    End Function

    Public Sub SetIndex(Index As Integer)
        cbxCategory.SelectedIndex = Index
    End Sub

    Public Sub SetValue(Value As Integer)
        cbxCategory.SelectedValue = Value
    End Sub

    Public Sub SetCategoryAll()
        LoadCategory()
    End Sub

    Public Event SelectedValueChanged(sender As Object, e As EventArgs)

    Private Sub cbxCategory_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxCategory.SelectedIndexChanged

    End Sub
End Class
