Private Sub Item_TypeComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Item_TypeComboBox.SelectedIndexChanged
        'auto increment for each type of items
        If Item_TypeComboBox.SelectedItem = "Bages" Then
            ItemIDTextBox.Text = Format("B" & (BagsIDTextBox.Text), "0000")

        ElseIf Item_TypeComboBox.SelectedItem = "Accessories" Then
            ItemIDTextBox.Text = Format("A" & (BagsIDTextBox.Text), "0000")

        ElseIf Item_TypeComboBox.SelectedItem = "Cloth" Then
            ItemIDTextBox.Text = Format("C" & (BagsIDTextBox.Text), "0000")

        ElseIf Item_TypeComboBox.SelectedItem = "Extra" Then
            ItemIDTextBox.Text = Format("E" & (BagsIDTextBox.Text), "0000")

        ElseIf Item_TypeComboBox.SelectedItem = "Perfume" Then
            ItemIDTextBox.Text = Format("P" & (BagsIDTextBox.Text), "0000")

        ElseIf Item_TypeComboBox.SelectedItem = "Phone Cover" Then
            ItemIDTextBox.Text = Format("PC" & (BagsIDTextBox.Text), "0000")

        ElseIf Item_TypeComboBox.SelectedItem = "Socks" Then
            ItemIDTextBox.Text = Format("S" & (BagsIDTextBox.Text), "0000")

        ElseIf Item_TypeComboBox.SelectedItem = "Scarfs" Then
            ItemIDTextBox.Text = Format("SC" & (BagsIDTextBox.Text), "0000")

        ElseIf Item_TypeComboBox.SelectedItem = "Makeup" Then
            ItemIDTextBox.Text = Format("M" & (BagsIDTextBox.Text), "0000")

        End If

Edited 4 Years Ago by pyTony: fencing ~~~ vb code tags added

It doesn't show an increment value in the id and when i choose type from the combo box it show me a message with error.

U are not incrementing the value anywhere so it wont show any value....there shud be a database or something that will store the max value and then increment the corresponding value for the combobox item....

Use the edit post link do not post again. And please indent all your code one level by highlight and pushing TAB key to make it formatted as Code or put
~~~ vb
~~~

around the code (line before and line after), ~ must be the first character on line.

I fixed your original post code block.

Comments
Good job Tony
This article has been dead for over six months. Start a new discussion instead.