Link to home
Start Free TrialLog in
Avatar of Ed
EdFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Concatenate Checkbox Values into Text Area

User generated imageUser generated imageI have checkbox that when' Checked' sets the  value of the checkbox into a textarea.

    Protected Sub chkReviewdate_CheckedChanged(sender As Object, e As EventArgs) Handles chkReviewdate.CheckedChanged
        CheckActions()
        txtNotes.Text = "Review date to be added or incorrect"
    End Sub

Open in new window


The problem is that when more than 1 checkbox is checked it overwrites the value in   txtNotes.Text with the latest checkbox value

What I would like to do is list ALL the values of the 'Checked' checkboxes, not just the last one. Whats the best way to achieve this?
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Hi Ed;

Try it something like this.
txtNotes.Text = txtNotes.Text & " " & "Append new value"

Open in new window

This should append the text as a new line
txtNotes.Text = txtNotes.Text & "\r\nReview date to be added or incorrect"
Avatar of Ed

ASKER

Thanks, I'll try that.  I would also like to add each value to a new line in the text area if that is possible.
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ed

ASKER

txtNotes.Text = txtNotes.Text & vbNewLine & "Append new value"

Open in new window

works perfectly.  Thanks
Not a problem Ed, glad to help.