Results 1 to 2 of 2

Thread: How can i add hidden column in vbcombo

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Location
    India
    Posts
    3

    Question

    Hello VB Gurus,
    how can i add one or more hidden columns in
    VB ComboBox.I would like to refer thier value in run time.
    Is any API function ???

    thanks for replying

    vetti..




  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    You could use an External Array to keep as many Extra hidden columns as you want, just use the Combo's ItemData as the link storing the Array Index (then you can sort the list without causing a problem), i.e.
    Code:
    Private sExCombo() As String
    
    Private Sub Form_Load()
        Dim lIndex As Long
        
        For lIndex = 0 To 9
            Combo1.AddItem "Item " & lIndex + 1
            ReDim Preserve sExCombo(Combo1.ListCount - 1)
            sExCombo(Combo1.ListCount - 1) = "Extra Value " & lIndex + 1
            Combo1.ItemData(Combo1.NewIndex) = lIndex
        Next
        Combo1.ListIndex = 0
    End Sub
    
    Private Sub Combo1_Click()
        Caption = sExCombo(Combo1.ItemData(Combo1.ListIndex))
    End Sub

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