0

hello i have string which is something like this

Dim products As String = "SANDWICH-1%MANGO JUICE-10%"

now i appended the % sign between every product while saving the combobox items in Microsoft access database

now what i want to do is to make this product string which i fetched from the database to add every single product in combobox4

i tried

products = products.Replace("%", "','")

Dim array() As String = {products}

For Each column As String In array
    ComboBox4.Items.Add(column)
Next

but the replace dont work properly the data comes in combobox in same line i want it as index 0 = SANDWICH-1 index 1 = MANGO JUICE-10

this way if you can help or this is how i appended the data to one string while inserting it into Microsoft access database

Dim productsincarts As String = String.Empty
        For Each itm As String In ComboBox4.Items
            productsincarts &= itm & "%"
        Next

1 Answer 1

1

You could use something like the following:

For Each item In products.Split(CChar("%"))
    ComboBox4.Items.Add(item)
Next

Probably better ways but this will achieve what you want.

Sign up to request clarification or add additional context in comments.

3 Comments

hello thanks bro it works but it adds one entry as null string and from second i can see the entry text any fix
i fixed it myself removed the item at index 0 from combobox thanks i am okay now
@android_guy Glad it worked, if you mark this as an answer it shows others what worked for you without them having to read the comments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.