Link to home
Avatar of Ernesto
ErnestoFlag for Mexico

asked on

combobox use

Hi you experts

i wandering if a combobox that contain information be able to do not deleted from the user but otherwise add more info if it want it

i mean
XXKU-3322-94  (that it contains)
i dont want to delete it but add more is aviable
XXKU-3322-9477-82
is that posible
tsm you experts
Avatar of Ark
Ark
Flag of Russian Federation image

You mean smth like this?:
Dim lastIndex As Long

Private Sub Combo1_Change()
  If lastIndex = -1 Then Exit Sub
  Dim s As String
  s = Combo1.Text
  Combo1.List(lastIndex) = s
  Combo1.ListIndex = lastIndex
  Combo1.SelStart = Len(s)
End Sub

Private Sub Combo1_Click()
   lastIndex = Combo1.ListIndex
End Sub

Private Sub Form_Load()
   For i = 0 To 9
       Combo1.AddItem "XXKU-3322-" & (i + 94)
   Next i
   lastIndex = 0
   Combo1.ListIndex = 0
End Sub

Open in new window

SOLUTION
Avatar of Ark
Ark
Flag of Russian Federation image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
ASKER CERTIFIED SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Ernesto

ASKER

i try to explain this
i dont want the user delete a string that is combined by a proyecto and requisición
like that
Proyecto:  1010
Requisición: XXIUIWW-TERS

the result of orden de compra is  proyecto + requisicion + a control number

i want the user only add the control number to the combobox orden de compra, but
do not delete the previous string

Orden de compra: 1010-XXIUIWW-TERS-001

is that posible
It is hard to find something that isn't possible, but I wouldn't recommend implementation. The way to do it would have to be that the user over-writes the existing with "1" and the program changes that into 1010 XXIUIWW-TERS-001 immediately. The better way should be do show all components of the number in separate textboxes and then display the entire construct somewhere else again. It might be worth your while to examine the possibility that the user has no interest in the number you are taking so much pain to show to him. He is likely to focus on selecting the correct project and requisition and add an index. The fact that all of this serves as a document ID may not gain any consequence until the document is produced.