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

Recommended Answers

All 6 Replies

What is the issue u r facing in this??? please explain in detail

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.

This what it shows.

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.

commented: Good job Tony +2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.