Making work better looking combobox control

elvagonumero1

New Member
Joined
Apr 24, 2012
Messages
15
Hi, I'm working on a userform that is needed to be better looking that the square-ish old windows style, I'm working on windows XP, so I started to look how to do it and really got good suggestions.


I managed fearly good putting images of round cornered boxes behind of transparent backstyled textboxes, but the problem came when I needed a combobox, for that I made it work using a texbox on top of a listbox, both in front of an image of a nice box with a round drop-down button on its right side, that looks quiet good but without accomplishing the behaviour that I want.


So, in synthesis what I want is that the textbox, the listbox and the image behind them could connect so that:
1. When the image is clicked the list comes out. Already done.
2. The textbox is filled with the selection on the listbox, wether double-clicked (done) or through enter key selection (struggling to do it, but can't achieve it)
3. When some text is entried on the textbox the listbox is shown (I know how to do it) and while text is typed the listbox is automatically filtering only the matching ones (working on it).
4. And if thing could be perfect, I want that while hovering values on the listbox they are shown on the textbox.


I found a lot of helping pieces of code that in some way fits my needs, but they're popping errors that I can't handle. I can't figure out how to mixed those pieces the right way.

I hope to express myself the right way (it's obviuos that I'm not a english native speaker). Thanks in advance


Here's what I've already got.



Code:
Public Sub lblBotonComboCodigo_Click()
    '------------
    'This is the label that holds the image of the round-cornered combo, its mission is to pops out the listbox so values
    'can be selected and then the textbox is filled.
    '------------
    If lstListaAEntregar.ListCount < 1 Then
        If lstMaterialV.Visible = False And lstRetiradopor.Visible = False And _
        lstAprobadopor.Visible = False Then    'this is done to avoid superposition of other two lists on the userform
            lstCodigoV.Visible = True
        End If
    Else
        CargarABitacora "ERROR: el documento de entrega no puede realizarse para más de una vivienda"
        Beep
    End If
End Sub


Code:
Public Sub lstCodigoV_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    '------------
    'This selects the value in fills the textbox and then hide the listbox
    '------------ 
    tbComboCodigoV.Value = lstCodigoV.Value
    lstCodigoV.Visible = False
End Sub


Code:
Private Sub lstCodigoV_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    '------------
    'This was supposed first to trigger the double click event but didn't (don't know why) and then I change to simply do     'the same thing as the double click event.
    '------------ 
    If KeyAscii = 13 Then
        With Me.lstCodigoV
            .Selected(.ListIndex) = Not .Selected(.ListIndex)
        End With
        tbComboCodigoV.Value = lstCodigoV.Value 'this line fires an error
        lstCodigoV.Visible = False 'this line also fires an error
    End If
End Sub
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,214,973
Messages
6,122,534
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top