selecting text part of combo box

  • Thread starter Thread starter george
  • Start date Start date
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
 
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
 
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.
 
Back
Top