Results 1 to 3 of 3

Thread: combo box

  1. #1

    Thread Starter
    Hyperactive Member yousufkhan's Avatar
    Join Date
    Jan 2002
    Location
    India
    Posts
    492

    combo box

    i m using a dropdown style combox readonly
    i m adding items from table as requirement of user
    but some times i wanted give blank record to combo from table
    that time it gives error property read only or
    how can bring it to the first item of combo items

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    I'm not sure what you want. You can set the combobox to the first item with combobox1.selecteditem = 0.
    If the problem is that the user can't add an item to the combobox, that's true when you have it set to read only. You'd have to deal with that in code.
    Sorry if I misunderstood your question.

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    If I understand your question correctly, you want to give the user
    the choice of a blank item and have it as the first item in the cbo.
    When you add the items to the cbo, add a blank item of one
    space character. Something like...
    VB Code:
    1. Private Sub Command1_Clikc()
    2.     Do While oRs.EOF = False
    3.         cboCombo1.Additem oRs!Field1
    4.         oRs.MoveNext
    5.     Loop
    6.     cboCombo1.AddItem " ", 0
    7.     cboCombo1.ListIndex = 0
    8. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width