Hello VbForums
When we click an item in a combobox, only one seleccted item is displayed in the combo text.
I want to display 3 items.
I created an invisible textbox but it didn't work.
Code:
Private Sub Combo1_Click()
n = n + 1
Select Case n
Case 1
Text1= Text1 + Combo1.Text
Case 2
Text1 = Text1 + " " & Combo1.Text
Case 3
Text1 = Text1 + " " & Combo1.Text
End Select
Combo1.text = Text1 .Text
End Sub
In Text1_Change event, I tried this but without success.
Code:
Private Sub Text1_Change()
Combo1.text = Text1 .Text
End Sub
There is no Multiselecting in a Combobox. Period!
AFAIK, you cannot set the textbox-part to multiline (except there is an API-hack!),
you cannot set the height of the textbox-Part to anything different except with FontSize.
If you need multiselect, then a Listbox is your friend.
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
There is no Multiselecting in a Combobox. Period!
AFAIK, you cannot set the textbox-part to multiline (except there is an API-hack!),
you cannot set the height of the textbox-Part to anything different except with FontSize.
If you need multiselect, then a Listbox is your friend.
Perhaps I was not clear enough.
I'm not looking for a multi selecting of items.
Each time I click an item, I want it to be displyed in the combo text without deleting the existing one.
I want to reproduce the conntent of the textbox in the combobox.
thanks
I've got a multi-select ComboBox. I've used it for years. It could use some work, as I'm not totally happy with it, but it does get the job done. Hold on and I'll post it.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Okay, here's a little demo (attached). I haven't looked at that code in the ComboCheck.ctl in a very long time, but it's a piece of code that's used everyday and is extremely well exercised. Again, it could probably use improvements, but it certainly gets a job done for me that's needed.
Enjoy,
Elroy
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Re: [RESOLVED] Add more than one item to Combo.Text
Interesting. It looks like a nicer implementation than mine.
Say wqweto, I suspect PGBSoft saw this thread and decided to post it. It looks "wrapped up" enough that I'm guessing, once-upon-a-time, PGBSoft tried to sell it, but has long given up on that, and is now offering it as open-source. But that's just my guess.
It's a nice enough implementation though that I might consider replacing mine with it. He's done a good job of eliminating the pulldown flicker that mine has, and I like the clean checkboxes.
These forums truly are amazing at times. Ask and ye shall receive.
Y'all Take Care,
Elroy
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Re: [RESOLVED] Add more than one item to Combo.Text
Yeah, I was studying the code. It looks like he's been developing this thing for a while. I was excited, but then I saw all the non-ComCtl32 style subclassing going on in it. It's monitoring for a great many message types.
Also, there's a tremendous amount of On Error Resume Next (and without being closed with On Error Goto 0) in it.
Also, I didn't study in great detail but the Property Let Text procedure is commented out. That would be a big handicap for me that would need to be resolved.
Say PGBSoft, if you're listening, could you give us a bit more information about how much this thing has been used? And, why are you leaning so heavily on On Error Resume Next, and why the Property Let Text procedure isn't available?
Take Care,
Elroy
EDIT1: Truth be told, this thing looks like an F15 fighter, and makes mine look like a P51. However, truth be told, an F15 may shoot down a P51 pretty quickly, but left to its own devices, the P51 was a phenomenally robust airplane (especially with the Rolls Royce Merlin engine in it).
Last edited by Elroy; Jun 30th, 2018 at 10:39 AM.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Re: [RESOLVED] Add more than one item to Combo.Text
Elroy,
Thank you for the quick code review.
If you are referring to “On Error Resume Next” statements in property settings, yes, most of them should not be. I simply put them at one stage of the development for a particular testing; hence they need to be cleared. Anyway, I will update the code. Thanks for pointing out it, which I had missed.
For your question about Text property setting, the property is not purposely allowed to set, since it is considered to be a read-only property. The reason is simply integrity purpose, because, the user is only allowed to select items from the list, where the selection is updated as the Text. If it is allowed to set this Text externally, it is going to be a problem. Simply, imagine a Dropdown list style of a regular ComboBox; its Text property setting is read-only when the Text to be set is not in the list. However, you can still set the Text here via the DefaultText property, but that is for a different purpose.
I have very recently started developing this control and it is still in testing.