Try this One:
I use "Text" as the datatype in my Database to ensure that the numbers will be saved with new lines like what you wish to do.
10
20
30
...
Hope this helps.
Dim str As String
str = _
IIf(CheckBox1.Checked = True, Label1.Text & " ", "") & _
IIf(CheckBox2.Checked = True, Label2.Text & " ", "") & _
IIf(CheckBox3.Checked = True, Label3.Text & " ", "") & _
IIf(CheckBox4.Checked = True, Label4.Text, "")
str = Replace(str, " ", vbCrLf)
con.Open()
cmd.Connection = con
cmd.CommandText = "INSERT INTO YourTableName(YourColumnName) Values(RTRIM(@str))"
cmd.Parameters.AddWithValue("@str", str)
cmd.ExecuteNonQuery()
con.Close()
I make use of IIF Statement to determine if the checkboxes are in CHECKED state. I used RTRIM in the query to remove unnecessary white spaces. And I didn't use any loop to save the string in the database because I already merged the selected strings in the IIF code before proceeding in the saving of data.