selecting text part of combo box

G

george

Hi,

On the click event of txtTest I use the following code to
select the whole text when I click on it:

Me.txtTest.SelStart = 0
Me.txtTest.SelLength = Len(Me.txtTest)

and it works well. However it doesn't work when I try to
do the same thing with a combo box. Can someone please
help?

Thanks in advance, george
 
J

Jeff

Hi George,

Put the same code in the MouseDown Event not the OnClick
& it will work.

Private Sub Combo2_MouseDown(Button As Integer, Shift As
Integer, X As Single, Y As Single)
Combo2.SelStart = 0
Combo2.SelLength = 4
End Sub

Jeff
 
M

Marshall Barton

george said:
On the click event of txtTest I use the following code to
select the whole text when I click on it:

Me.txtTest.SelStart = 0
Me.txtTest.SelLength = Len(Me.txtTest)

and it works well. However it doesn't work when I try to
do the same thing with a combo box. Can someone please
help?


The Enter event is usually more appropriate.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top