Clear Form

  • Thread starter Thread starter David A. Osborn
  • Start date Start date
D

David A. Osborn

Is there an easy way to dynamically delete all the controls on a form
without knowing exactly what the controls are?
 
This seems to "Deletes" the controls from the form.
IS there a way to clear the values/contents in all the fields of a form
using a single (or) a set of commands ?
 
S Anand said:
This seems to "Deletes" the controls from the form.
IS there a way to clear the values/contents in all the fields of a form
using a single (or) a set of commands ?

You may want to recursively loop though all the controls and reset them.
 
Anand,

This was your first question on which Alejandro answered and than you reply
This seems to "Deletes" the controls from the form.

I find this not a fair reply to Alejandro.

Setting a form to "new" is the most easy way to reset it to its base format
in my opinion.

Just my thought,

Cor
 
Cor,

Apologies for the confusion. I saw this post and asked a related question.
How/where can we set a form to new ?
We want to make this call from an icon in our form. We are not able to call
Me.New() or MyBase.New() as they are constructor methods.

Thanks in advance.

Anand
 
Anand,

I don't know if it is a real good solution, however when I tried this I
thought it gave me the result as expected with a designer created form.

\\\
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Me.Controls.Clear()
InitializeComponent()
End Sub
///

I hope this helps?

Cor
 
Cor,

Yes, it is a solution. We tried it and it works - it basically removes all
the controls and repaints the screen.

thanks

Anand
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top