Hey, i'm recently new in this forum, so if i'm doing something wrong, please tell me!
I have a problem that is driving me nuts!

Here's the thing, i want to know if there is any way of remove checkboxes dynamically, with code. I know that there is a way to add them, but i dont know how to remove them!

To add them, i have this code:

Me.Controls.Add(ChkBox)
ChkBox.Location = New Point(offsetWidht, offsetHeight)
ChkBox.Text = sqlRead.Item(1).ToString
ChkBox.Name = sqlRead.Item(0).ToString

There is any code to do the opposite, to remove them?

Best regards,

Rafael Sousa

Greetings!

Actually i found a solution!

This is the code that i used to solve this. (in case anyone else has the same problem!)

While sqlRead.Read()
Me.Controls.RemoveByKey(sqlRead.Item(0).ToString)
End While

This worked for the code i was developing.

Best regards,

Rafael Sousa

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.