combo box items

gmit

Registered User.
Local time
Today, 11:31
Joined
Jan 27, 2004
Messages
23
Hi All
Does anybody know is it possible to disable an item in a combo box? I have a combo box with the contents index mapping to primary key records. I don't want to remove any of the contents as this would alter the index. I would like to disable the option when it has been selected to stop it being selected twice. Any ideas would be welcome.
 
Hi All
Does anybody know is it possible to disable an item in a combo box?
I don't think you can do this. But, you have plenty of other options. Like, using message boxes, deletion code, focus code, etc...

You can use a variety of other tools that are available to help you get this done. But, the bottom line is, I don't think you can do what you have asked. I don't know for sure, but I bet you could reduce your headaches by producing a workaround. :)
 
I think you are correct and this can't be done so I used error checking instead. Not sure if this will help anyone but here goes:
What I wanted to do was create a check box at run time when the user selects a combo box option. Once the check box was created if the user selected the same option my program error ed and crashed. I used error checking to resolve this problem, code below hopefully will give you ideas.

Dim i As Integer
Static lasti As Integer

On Error GoTo subError
i = 0
i = cboEmailAddress.ListIndex

If (i > 0) Then
Load chkEmails(i)
chkEmails(i).Value = 1 'make selected
chkEmails(i).Caption = cboEmailAddress.Text
chkEmails(i).Visible = True
chkEmails(i).Top = chkEmails(lasti).Top + chkEmails(lasti).Height
'increment the last index
lasti = i
End If
Exit Sub

subError:
MsgBox "Address already added"
Exit Sub

If the same combo box option is selected twice a check box with the same index number would be created causing program error. By adding error checking I simply exit sub and the program carries on as normal.
 
combo box

i'm trying to display on the screen 2 columns using a combo box after I made my selection. ( a list box you can display more than 1 columns)



name company contact

mr x xxx 234
mr y yyy 123



I know how to populate the combo box but how do you display more than one column after you pick or choose them?


how could i display on the screen the name and company using a combo box
 

Users who are viewing this thread

Back
Top Bottom