VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Procedure that saves the text typed into a combobox into the comboboxes list. Like Internet Explore

by Thasnake (2 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Thu 12th September 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Procedure that saves the text typed into a combobox into the comboboxes list. Like Internet Explorer address bar.

Rate Procedure that saves the text typed into a combobox into the comboboxes list. Like Internet Explore



On Error GoTo Err:

Dim val As String
Dim i As Long
Dim match As Boolean

val = Trim(cboName.Text)

For i = 0 To cboName.ListCount - 1       
    If cboName.List(i) = val Then   
        match = True                 
        Exit For                    
    Else
        match = False
    End If
Next i 
                             
If match = False Then
    cboName.AddItem val
    'You could add code here to save the values
    'to a file or registry or something like that
    'so they can be loaded back in next time 
    'program is started
End If

Exit Sub
Err:

MsgBox "Sorry, there was an error!. " & vbCrLf & _
       "Please try again.", vbExclamation, "Error"
End Sub

Download this snippet    Add to My Saved Code

Procedure that saves the text typed into a combobox into the comboboxes list. Like Internet Explore Comments

No comments have been posted about Procedure that saves the text typed into a combobox into the comboboxes list. Like Internet Explore. Why not be the first to post a comment about Procedure that saves the text typed into a combobox into the comboboxes list. Like Internet Explore.

Post your comment

Subject:
Message:
0/1000 characters