473,507 Members | 2,545 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Clear Form

Is there an easy way to dynamically delete all the controls on a form
without knowing exactly what the controls are?


Nov 21 '05 #1
7 1794
Me.Controls.Clear

Alejandro Lapeyre

"David A. Osborn" <do********@hotmail.com> escribió en el mensaje
news:k0lFd.3309$OF5.950@attbi_s52...
Is there an easy way to dynamically delete all the controls on a form
without knowing exactly what the controls are?

Nov 21 '05 #2
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 ?

"alejandro lapeyre" wrote:
Me.Controls.Clear

Alejandro Lapeyre

"David A. Osborn" <do********@hotmail.com> escribió en el mensaje
news:k0lFd.3309$OF5.950@attbi_s52...
Is there an easy way to dynamically delete all the controls on a form
without knowing exactly what the controls are?

Nov 21 '05 #3
"S Anand" <x@hotmail.com> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #4
Anand,
Is there an easy way to dynamically delete all the controls on a form
without knowing exactly what the controls are?

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
Nov 21 '05 #5
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

"Cor Ligthert" wrote:
Anand,
Is there an easy way to dynamically delete all the controls on a form
without knowing exactly what the controls are?


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

Nov 21 '05 #6
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
"S Anand" <x@hotmail.com> schreef in bericht
news:CC**********************************@microsof t.com...
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

"Cor Ligthert" wrote:
Anand,
>> Is there an easy way to dynamically delete all the controls on a form
> >without knowing exactly what the controls are?


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

Nov 21 '05 #7
Cor,

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

thanks

Anand

"Cor Ligthert" wrote:
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
"S Anand" <x@hotmail.com> schreef in bericht
news:CC**********************************@microsof t.com...
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

"Cor Ligthert" wrote:
Anand,

>> Is there an easy way to dynamically delete all the controls on a form
> >without knowing exactly what the controls are?

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


Nov 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
8075
by: Matt | last post by:
i need to implement a clear button to clear all the fields in the form, but i am thinking i can just use reset button. <input type="reset" name="reset" value="CLEAR"> The first thought is...
0
3342
by: Doslil | last post by:
I have a form which is designed to only data entery.When i try to open to form in the run form I have the following errors 1. when i open the form I get an error message saying "Access can't...
3
1361
by: Infidel | last post by:
Hi there, Can anyone tell me how I can stop this from happening. Basically, I'm using validation controls on a form which works great... but, perhaps a little TOO great. When I click Clear......
21
5170
by: StriderBob | last post by:
Situation : FormX is mdi child form containing 2 ListViews ListView1 contains a list of table names and 4 sub items with data about each table. ListView2 contains a list of the columns on each...
0
4815
by: Flack | last post by:
I have pasted at the end of this message a small sample program I whipped up to do some testing. It's a form with a datagrid and two buttons. Each button clears the dataTable that is the source...
2
6260
by: Mike | last post by:
Ok I'm having a problem with a listview. I have a listview on a WinForm called ProgramInformationFrm. I call this from from 2 other forms. One is ProgramSearch Frm, the other is OpenNCFrm. The...
5
5777
by: plumba | last post by:
Ok, another query.... I have a checkbox at the bottom of my form which when checked unhides a <div> block which displays the submit button. The problem I have is when the clear form button is...
5
4487
by: karsagarwal | last post by:
I have a bounded form and after I click the button to update/save. THe fields are still there. Is there a way to clear off the fields in the bounded form. Thanks, SA Here's the code that I...
32
2752
by: =?Utf-8?B?U2l2?= | last post by:
I have a form that I programmatically generate some check boxes and labels on. Later on when I want to draw the form with different data I want to clear the previously created items and then put...
5
10794
aas4mis
by: aas4mis | last post by:
I haven't had much luck with specific controls, their properties and loops in the past. I thought I would share this tidbit of code, feel free to modify/modularize in any way to suit your needs. This...
0
7110
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.