The basics for creating your string is to create a list(Of CheckBox), use it to query which CheckBox controls are checked e.g.
Public Class Form1
Public checkBoxList As List(Of CheckBox)
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim values As String = "Drinks " &
String.Join(" ", checkBoxList _
.Where(Function(cb) cb.Checked).Select(Function(cb) cb.Text))
' use values for placing into your DataGridView
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
checkBoxList = New List(Of CheckBox) From {CheckBox1, CheckBox2, CheckBox3}
End Sub
End Class
ComboBoxes which I do DropDownStyle = DropDownList and ensure a item is selected
Public Class Form1
Private comboBoxList As List(Of ComboBox)
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim values As String = "Food " & String.Join(" ",
comboBoxList.Select(Function(cb) cb.Text))
Label1.Text = values
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
comboBoxList = New List(Of ComboBox) From
{
ComboBox1,
ComboBox2,
ComboBox3,
ComboBox4
}
comboBoxList.ForEach(Sub(cb)
cb.DropDownStyle = ComboBoxStyle.DropDownList
cb.SelectedIndex = 0
End Sub)
End Sub
End Class
Variation, we don't make an initial selection.
Public Class Form1
Private comboBoxList As List(Of ComboBox)
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim values As String = "Food " & String.Join(" ",
comboBoxList.Where(Function(cb) Not String.IsNullOrWhiteSpace(cb.Text)) _
.Select(Function(cb) cb.Text))
Label1.Text = values
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
comboBoxList = New List(Of ComboBox) From
{
ComboBox1,
ComboBox2,
ComboBox3,
ComboBox4
}
comboBoxList.ForEach(Sub(cb)
cb.DropDownStyle = ComboBoxStyle.DropDownList
End Sub)
End Sub
End Class