So I’m trying to make a combobox use a string that has other strings and has text too.
Like so:
Dim numbers() As String = {one, two, three, "four", "five"}
ComboBox1.text = numbers
I’m trying to use numbers more than once so I want everything to be in there. I tried using:
Dim numbers As String = (one or two or three or "four" or "five")
but that didn’t work either. Is there any way to make this possible? I looked all over the internet for help and all i got was array lists and conversions to strings. I’m Trying to make one line of code that has everything.
Edit: Let me rephrase that. I’m trying to do this:
Dim numbers As String = (one or two or three or "four" or "five")
ComboBox1.items.add(numbers)
If Combobox1.text = numbers Then
TextBox1.text = "is showing"
End if
The first syntax you are using is creating an array. It is confusing what you are wanting as an end result, but if you are just wanting to join String’s and Text you can use
&which is one of the VB Concatenation operaters.Edit base on further clarification. It sounds like you are wanting something like DataBinding. see if this code works for you.
Try something like this
You can create your string this way
or this way
Fill your ComboBox like LarsTech suggested.
And check for a match like this