evanmarshall
asked on
How to reset combobox to default value after use
I have a combobox that is populated with items according to the user's input. The combobox's default text is "Select Section Character." My problem is that after the user has made a selection, the combobox does not reset to display "Select Section Character" for the next use. Instead, it still displays the user's previous selection. I have tried everything but can't get it to work.
Here is my code that populates the combobox:
Private Sub btnWordLengthSubmit_Click( ByVal sender As Object, _
ByVal e As System.EventArgs) Handles btnWordLengthSubmit.Click
cboSelectSectionCharacter. Items.Clea r()
cboSelectSectionCharacter. Items.Add( strLeadNam e)
cboSelectSectionCharacter. Text = "Select Section Character"
Select Case dblWordLength
Case 50000 To 64000
cboSelectSectionCharacter. Items.Add( strVP2)
Case 65000 To 89000
cboSelectSectionCharacter. Items.Add( strVP2)
cboSelectSectionCharacter. Items.Add( strVP3)
Case 90000 To 114000
cboSelectSectionCharacter. Items.Add( strVP2)
cboSelectSectionCharacter. Items.Add( strVP3)
cboSelectSectionCharacter. Items.Add( strVP4)
Case 115000 To 139000
cboSelectSectionCharacter. Items.Add( strVP2)
cboSelectSectionCharacter. Items.Add( strVP3)
cboSelectSectionCharacter. Items.Add( strVP4)
cboSelectSectionCharacter. Items.Add( strVP5)
Case 140000 To 154000
cboSelectSectionCharacter. Items.Add( strVP2)
cboSelectSectionCharacter. Items.Add( strVP3)
cboSelectSectionCharacter. Items.Add( strVP4)
cboSelectSectionCharacter. Items.Add( strVP5)
cboSelectSectionCharacter. Items.Add( strVP6)
End Select
And here is the code for when the user makes a selection in the combobox:
Private Sub cboSelectSectionCharacter_ SelectedIn dexChanged (ByVal sender As Object, _
ByVal e As System.EventArgs) Handles cboSelectSectionCharacter. SelectedIn dexChanged
Dim strNodeName As String = treNovelStructure.Selected Node.Name
Select Case strNodeName
Case "8"
strVPCharacterOfSection8 = cboSelectSectionCharacter. SelectedIt em
txtSectionCharacter.Text = strVPCharacterOfSection8
DrawTree()
Dim node() As TreeNode = treNovelStructure.Nodes.Fi nd("8", True)
If Not node.Length = 0 Then
treNovelStructure.Selected Node = node(0)
End If
treNovelStructure.Focus()
treNovelStructure.Selected Node.BackC olor = Color.MidnightBlue
...
End Select
End Sub
I also have the combobox's text property set to "Select Section Character."
What am I doing wrong/not doing? Any help will be greatly appreciated. Many thanks in advance.
Here is my code that populates the combobox:
Private Sub btnWordLengthSubmit_Click(
ByVal e As System.EventArgs) Handles btnWordLengthSubmit.Click
cboSelectSectionCharacter.
cboSelectSectionCharacter.
cboSelectSectionCharacter.
Select Case dblWordLength
Case 50000 To 64000
cboSelectSectionCharacter.
Case 65000 To 89000
cboSelectSectionCharacter.
cboSelectSectionCharacter.
Case 90000 To 114000
cboSelectSectionCharacter.
cboSelectSectionCharacter.
cboSelectSectionCharacter.
Case 115000 To 139000
cboSelectSectionCharacter.
cboSelectSectionCharacter.
cboSelectSectionCharacter.
cboSelectSectionCharacter.
Case 140000 To 154000
cboSelectSectionCharacter.
cboSelectSectionCharacter.
cboSelectSectionCharacter.
cboSelectSectionCharacter.
cboSelectSectionCharacter.
End Select
And here is the code for when the user makes a selection in the combobox:
Private Sub cboSelectSectionCharacter_
ByVal e As System.EventArgs) Handles cboSelectSectionCharacter.
Dim strNodeName As String = treNovelStructure.Selected
Select Case strNodeName
Case "8"
strVPCharacterOfSection8 = cboSelectSectionCharacter.
txtSectionCharacter.Text = strVPCharacterOfSection8
DrawTree()
Dim node() As TreeNode = treNovelStructure.Nodes.Fi
If Not node.Length = 0 Then
treNovelStructure.Selected
End If
treNovelStructure.Focus()
treNovelStructure.Selected
...
End Select
End Sub
I also have the combobox's text property set to "Select Section Character."
What am I doing wrong/not doing? Any help will be greatly appreciated. Many thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.