0
votes

I have 3 checkboxes and 1 textbox

checkbox1, checkbox2, checkbox3

when i check first checkbox1 and then checkbox3 then in textbox it will appear as 1,3 exactly........ !!

using vb.net only.........

1
I don't have the appropriate reputation to officially mark this, but this is pretty close to a duplicate of: stackoverflow.com/questions/4090421/…GendoIkari
^^ Which was asked by the same user, just an hour earlier.GendoIkari

1 Answers

2
votes

Try:

Private Sub CheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged, CheckBox2.CheckedChanged, CheckBox1.CheckedChanged

    Dim sb As New System.Text.StringBuilder
    sb.Append(CStr(IIf(CheckBox1.Checked, "1 ", "")))
    sb.Append(CStr(IIf(CheckBox2.Checked, "2 ", "")))
    sb.Append(CStr(IIf(CheckBox3.Checked, "3 ", "")))
    TextBox1.Text = sb.ToString.Trim
End Sub