It is not a good idea to store the texts in labels and to apply the logic directly to those controls. You need a data model that makes your logic independent of your controls. The controls are used for input and output, i.e., for the interaction with the user. The data model on the other side reflects the structure of the problem and makes it easier to work with.
Example:
' Data model
Dim sentence As String() = {"I", "have", "nothing", "12"}
Dim replacement As String() = {"You", "had", "something", "8"}
' If you must fill combo boxes, you might need a more complex model, with a list of
' a displayable object containing an array. But I try to keep my answer simple to
' demonstrate the separation of concerns.
Based on this, you can initialize your controls. Assuming that the combo boxes are named ComboBox0 through ComboBox3 (rename them if not).
' Model to UI
Label9.Text = String.Join(" ", sentence)
For i As Integer = 0 To replacement.Length - 1
Controls("ComboBox" & i).Text = replacement(i)
Next
Then apply your logic
Dim result As String() = New String(sentence.Length - 1) {}
For i As Integer = 0 To sentence.Length - 1
' UI to model (where isChecked models the checked state of a ComboBox)
Dim isChecked As Boolean = CType(Controls("ComboBox" & i), ComboBox).Checked
' Logic applied to model
If isChecked Then
result = replacement(i)
Else
result = sentence(i)
End If
Next
Finally, output the result:
' Model to UI
Label8.Text = String.Join(" ", result)
You could also use String.Split instead, to initialize the word arrays:
Dim sentence As String() = "I have nothing 12".Split(" "c)
Dim replacement As String() = "You had something 8".Split(" "c)
This is only the first step in separating business logic and code related to UI. A better solution would be to place all of the business logic into its own class. See also: Robert’s Rules of Coders: #11 Separate User Interface Logic From Business Logic
Label8, so that it will contain only the text from the last checkbox checked. It is difficult to understand what you are doing. Can you give us examples together with the expected output?Label9.Text= "ABC",ComboBox2.Text= "123",ComboBox6.Text.Substring(1, 1)= "Z",CheckBox1.Checked= True, andCheckBox8.Checked= True, then what should the value ofLabel8.Textbe?