0

As for the form, the user enters the data, but if they need to add additional items (i.e. more people, property vehicles), I need the data to save to an excel file, but clear the form. I have been able to get the textboxes and rich textboxes to clear, but I am unsure how to have combo boxes clear out (go blank). Here is a snippet of what I've written for the text and rich textboxes. Intellisense won't let me select selectindex and I'm currently stuck.

For Each Me.cControl In Person.Controls
If (TypeOf cControl Is TextBox) Then
cControl.Text = ""
End If
If (TypeOf cControl Is RichTextBox) Then
cControl.Text = ""
End If
Next cControl

Edited by __avd: Added [code] tags.

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by Reverend Jim
0

Try this :

Private Sub ClearCombo(ByVal MyCombo As ComboBox)
    MyCombo.Items.Clear()
End Sub

For Each ccontrol In Me.Controls
    If TypeOf ccontrol Is ComboBox Then
        ccontrol.Text = ""
        ClearCombo(ccontrol)
    End If
Next ccontrol

Edited by Jx_Man: code tag

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.