Reset Button

TheMac

New member
Joined
Mar 5, 2009
Messages
2
Programming Experience
Beginner
Hey guys,

was wondering if someone could tell me or point me in the rite direction how I can clear the contents of a listbox and all other feilds.

this is what I have upto now, and this clears texbox, checkboxes ect... but it wont clear contents that appears in a listbox:

Private Sub ClearFields()
Dim ctrl As Control
For Each ctrl In Me.Controls
If ctrl.GetType Is GetType(TextBox) Then
ctrl.Text = ""
ElseIf ctrl.GetType Is GetType(CheckBox) Then
Dim chkbx As CheckBox = ctrl
chkbx.Checked = False
ElseIf ctrl.GetType Is GetType(ListBox) Then
End If
Next
End Sub

if anyone can help me out tht wud be greatly appreciated
 
Try:

VB.NET:
If ctr.GetType is GetType(Listbox) Then
Dim lsb As Listbox = ctr
lsb.items.clear()

Its the same format you already were using.
 
Back
Top