tektipdjango
IS-IT--Management
- Jan 28, 2004
- 188
when you click in a comboBox the text is not selected even if in the
event onClick you write the following code which works with a textBox:
(cBox is the name of the comboBox)
cBox.SelStart = 0
cBox.SelLength = Len(cBox.Text)
It looks like Access is sending an event after the onclick for the
cursor to go inside the text of the comboBox.
To succeed you have to put the code in the mouseUp event.
But this prevents you to select a part of the text the usual way.
To achieve this, declare a variable in the form module :
---------------
dim arrivalInCBox as Boolean
sub cBox_Enter()
arrivalInCBox =true
end sub
sub cBox_MouseUp()
if arrivalInCBox =True then
cBox.SelStart = 0
cBox.SelLength = Len(cBox.Text)
arrivalInCBox =False
end if
end sub
---------------
event onClick you write the following code which works with a textBox:
(cBox is the name of the comboBox)
cBox.SelStart = 0
cBox.SelLength = Len(cBox.Text)
It looks like Access is sending an event after the onclick for the
cursor to go inside the text of the comboBox.
To succeed you have to put the code in the mouseUp event.
But this prevents you to select a part of the text the usual way.
To achieve this, declare a variable in the form module :
---------------
dim arrivalInCBox as Boolean
sub cBox_Enter()
arrivalInCBox =true
end sub
sub cBox_MouseUp()
if arrivalInCBox =True then
cBox.SelStart = 0
cBox.SelLength = Len(cBox.Text)
arrivalInCBox =False
end if
end sub
---------------