Click here to Skip to main content
12,550,111 members (48,019 online)
Rate this:
Please Sign up or sign in to vote.
I can clear all the text boxes when i press reset button ,ie, txtName.text = "".. i can clear the combo boxes in the same way,but how do i reset the radiobuttons,checkboxes and listbox contents that have been selected.
Posted 8-Dec-12 14:15pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Its C# code, I've solved yesterday similar kinda question :
private void button1_Click_1(object sender, EventArgs e)
           List<TextBox> t = new List<TextBox>();
           foreach (TextBox txt in t)
           comboBox1.SelectedIndex = 0;
           checkBox1.Checked = false;
           radioButton1.Checked = false;
for C# to VB, follow this link :[^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Thanks for that dude ,but i barely have a grasp of,being a complete novice and all that.
I need an answer with Vb code,the converter doesn't work,it keeps telling me there is an error.
Much thanks anyway :)
Comments 10-Dec-12 0:03am
should be posted as comments.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

like this:

Private Sub ResetTxtBox()
    For Each x As TextBox In Me.Controls
        x.Text = String.Empty
End Sub
Comments 10-Dec-12 0:05am
works only for textboxes and throws error in case these are controls other than textbox.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.161021.1 | Last Updated 9 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100