I need help with clearing the text boxes when the submit
button is clicked. I am developing a web application. I
have tried placing the following code in the button_click
event, but this doesn't work.
Dim c As Control
For Each c In Me.Controls
If TypeOf(c) Is TextBox Then
CType(c, TextBox).Text = ""
End If
Next
Thanks, 5 1700
"Kemp" <fl***********@arvinmeritor.com> schrieb I need help with clearing the text boxes when the submit button is clicked. I am developing a web application. I have tried placing the following code in the button_click event, but this doesn't work.
"Doesn't work" is rarely a good description. ;-)
Dim c As Control
For Each c In Me.Controls If TypeOf(c) Is TextBox Then
If TypeOf c Is TextBox Then
CType(c, TextBox).Text = "" End If Next
In a WinForms application, this processes only the controls on the Form, not
those contained in controls on the Form. Maybe/probably it is the same in a
Web application.
--
Armin http://learn.to/quote http://www.plig.net/nnq/nquote.html
Hi Kemp
It does work not normal on a WebForm as documentated, I thought this was
working.
\\\
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim frm As Control = Me.FindControl("Form1")
Dim ctl As Control
For Each ctl In frm.Controls
Dim tb As TextBox
If TypeOf ctl Is TextBox Then
tb = DirectCast(ctl, TextBox)
tb.Text =""
End If
Next
///
I hope this helps a little bit?
Cor -----Original Message----- "Kemp" <fl***********@arvinmeritor.com> schrieb I need help with clearing the text boxes when the submit button is clicked. I am developing a web application.
I have tried placing the following code in the
button_click event, but this doesn't work. "Doesn't work" is rarely a good description. ;-)
Dim c As Control
For Each c In Me.Controls If TypeOf(c) Is TextBox Then
If TypeOf c Is TextBox Then
CType(c, TextBox).Text = "" End If Next
In a WinForms application, this processes only the
controls on the Form, notthose contained in controls on the Form. Maybe/probably
it is the same in aWeb application.
-- Armin
http://learn.to/quote http://www.plig.net/nnq/nquote.html
Sorry about the "Doesn't work" comment. This just seems
like a simple task and I am struggling with it. Is there
a better way to achieve this?
"Armin Zingler" <az*******@freenet.de> schrieb CType(c, TextBox).Text = ""
....and I prefer
DirectCast(c, TextBox).Text = ""
--
Armin
Hi Anonymous,
Dit you mean, this? http://learn.to/quote http://www.plig.net/nnq/nquote.html
Sorry about the "Doesn't work" comment. This just seems like a simple task and I am struggling with it. Is there a better way to achieve this?
:-)))))))))))))))) This in not Serious but ment for Armin, you got my answer
in the thread
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ben Dover - Mental Patient 0057 |
last post by:
I have these text boxes that start with a check box:
I want to clear boxes in a row.
user clicks on first check box, that row of text boxes...
|
by: |-|erc |
last post by:
these 3 lines will put the following into the URL bar!
but with 2 input boxes it doesn't.
<form name=test>
<INPUT name='selqty2'>
</form>
file:///C:/WINDOWS/DESKTOP/tttt2.html?selqty2=55555
|
by: Mark |
last post by:
Hi,
Im trying to validate a form, all the validating works apart from one field.
This particular field must consist of the first 2 characters as letters, &
the following 5 as numbers. And if it...
|
by: Galina |
last post by:
Hello
I have 6 dependent list boxes on my ASP page:
Faculty;
Lecturer;
Course;
Course occurrence;
Group;
Week commencing date.
When faculty is selected, lists of lecturers and...
|
by: Lal |
last post by:
dear all
On my project all forms have 10-25 text boxes, i want to clear these text
boxes.
insted of typing .clear on every text boxes any single command for a
particular form
i am new in .net...
| |
by: shank |
last post by:
I posted this in an HTML forum, but I think it's going to take some
scripting to act as I want to act.
I have a form with multiple records.
My intention is to have the user click a checkbox for...
|
by: adarshyam |
last post by:
can anybody tel me how to clear values from dynamically created text boxes?? using a clear button.. this is the code used to create dynamic text boxes.. if i press clear button then it must clear all...
|
by: stewdizzle |
last post by:
I have a from with three radio buttons (same group) and three text boxes. The radio buttons give the user a choice of uploading one, two, or three images. Currently, I have the text boxes load as...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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...
| |
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,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 ...
| |