dimanche 20 août 2023

Fill textbox based on checkbox choices and prevent doubles

I have the following code to fill a textbox based on checkbox choices on buttonclick.

 If ChkOM.Checked Then
    txtOpp.Text += ChkOM.Text & Environment.NewLine
Else
    txtOpp.Text = ""
End If
If ChkHSM.Checked Then
    txtOpp.Text += ChkHSM.Text & Environment.NewLine
Else
    txtOpp.Text = ""
End If

This code works to an extend, but when i uncheck and later recheck the box it will fill the textbox with 2x the same text. how do i prevent these doubles?




Aucun commentaire:

Enregistrer un commentaire