I have a groupbox with quite a few checkboxes.

I want a specific textbox to have custom string per checkbox in the text box.

Exemple

chckBox1
chckBox2
chckBox3
chckBox4
chckBox5
chckBox6

I checked 1, 3 and 6

So my textbox will contain as text

ckbox1, chkbox3, chkbox6

if i uncheck chkbox3

textbox will contain as text

chkbox1, chkbox6

Been breaking my head on this for quite some time now :(

maybe im wrong with what u mean,

private sub determinecheckstatus(ByVal sender As System.Object, ByVal e As System.EventArgs) handles checkbox1.CheckedChanged, checkbox2.checkedchanged, checkbox3.checkchanged and so one

dim textboxtext as string = string.empty

if checkbox1.checked then textboxtext += " checkbox1, "
if checkbox2.checked then textboxtext += " checkbox2, "
if checkbox3.checked then textboxtext += " checkbox3, "
and so on

textbox1.text = textboxtext
end sub

i am not the best with vb.net, but that should do what u are looking for
someone probably has a better method tho

commented: Thnx +1

Thanks, works fine :D

Since using a String and not a Number, use the "&" to "add to" the value of a String and not try and "add up" the value of a String by using "+".

if checkbox1.checked then textboxtext &= " checkbox1, "

Even though the "+" will probably work, have not tested, it is better for you and others in the long run when reviewing code. If "&", you will know that it "adds to" the value, and not "add up" the value.

Hope this helps.

commented: thats code, gave me usefull advice + +2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.