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
Visual Basic.NETVisual Basic ClassicVB Script

Avatar of undefined
Last Comment
Faustulus

8/22/2022 - Mon
Ark

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
Ark

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER CERTIFIED SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
Ernesto

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
Faustulus

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.
Your help has saved me hundreds of hours of internet surfing.
fblack61