back up codes

always have a backup of your code

Archive for the tag “reset”

reset dropdownlist

The following code will reset the dropdownlist on button click.

First create a subroutine as below:

Private Sub resetDropdown(ByVal cs As ControlCollection)
Dim c As Control
For Each c In cs
If TypeOf c Is DropDownList Then
CType(c, DropDownList).SelectedValue= "0"
End If
resetDropdown(c.Controls)
Next
End Sub

After creating the subroutine, call it on the button event:

resetDropdown(Me.Controls)

Post Navigation

Follow

Get every new post delivered to your Inbox.