Question : vb.net Programmatically Reset Form

I want to loop through the controls whether it's a textbox, dropdownlist or whatever and reset them all to their original state. What I listed below works, but there has to be an easier more modular method that I would work for all forms.

Thanks.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
Protected Sub Clear_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Clear.Click
        TextBox5.Text = ""
        TextBox2.Text = ""
        DropDownList4.Text = "Select an OS"
        TextBox10.Text = ""
        TextBox13.Text = ""
        TextBox1.Text = ""
        DropDownList1.Text = "Select an Option"
        DropDownList2.Text = "Select an OS"
        TextBox3.Text = ""
        TextBox4.Text = ""
        DropDownList5.Text = "Yes or No"
        TextBox6.Text = ""
        TextBox7.Text = ""
        TextBox8.Text = ""
        TextBox9.Text = ""
        DropDownList10.Text = "Not Connected or Type"
        TextBox11.Text = ""
        TextBox12.Text = ""
        DropDownList13.Text = "Yes or No"
        TextBox14.Text = ""
    End Sub

Answer : vb.net Programmatically Reset Form

Is this a Web.Form?

I would simply reload the form... Response.Redirect("FormName.aspx")

Espavo

Random Solutions  
 
programming4us programming4us