Logo
English Russian German French Spanish Italian
contact usprivacy
   Support Forums
chart
• Adjust flexgrid cell
• Animation
• Centering form text
• Coffee machine
• Creating fileshares
• Creating shortcuts
• Custom buttons
• Directory browser
• Disable mouse events
• File search by ext
• File transfer
• File watcher
• Formatting flexgrid
• Get Content Type
• Get HTML source
• Get modem port
• HTTP proxy
• ipconfig
• Large file split/merge
• MAPI
• MCI Sound Player
• Menu with images
• MP3 normalizer
• Net Send
• Netstat 2000
• No duplicate entries
• Outlook Address Book
• Set font color
• Shapes
• SOAP test
• Text-to-image
• Text file viewer
• Text find/replace
• UPS component
• View NT groups
• Word template
• Writing DNS control
    • Using DNS control
• Writing SMTP control
    • Sending email
    • Mailing list
• Writing WhoIs control
    • Using WhoIs control
• View HTML source
VB projects - No duplicate entries in combo box

Description: do not permit duplicate entries in combo box
Minimum requirements: VB6
Download: source code
Screenshot:
VB projects - No duplicate entries in combo box
Project: EXE
Controls: CommandButton cmdAdd (Caption = "Add"), TextBox txt, ComboBox cmb
Additional references: Microsoft Scripting Runtime (scrrun.dll)
Code:
Option Explicit

Dim dRecords As New Dictionary

Private Sub cmdAdd_Click() On Error GoTo err_Add If txt.Text <> "" Then dRecords.Add txt.Text, txt.Text 'if record already exists error will occur cmb.AddItem txt.Text MsgBox "Added 1 record" End If txt.SetFocus Exit Sub err_Add: MsgBox "Record already exists" txt.SetFocus End Sub
Private Sub txt_GotFocus() txt.SelStart = 0 txt.SelLength = Len(txt) End Sub

Copyright © 1996-2008 OstroSoft. All rights reserved. info@ostrosoft.com