PDA

Click to See Complete Forum and Search --> : Howto remove all items from a combobox


Inhumanoid
Nov 22nd, 1999, 05:29 PM
How do I remove al items from a combobox but leave the comboboxes text intact...

Also it should not create an error if there are no items in the list...

onerrorgoto
Nov 22nd, 1999, 06:07 PM
use .clear to remove all items from list.
When you clear the list, add the text to a temp variable and set the text back after the list is cleard.

code examplpe with one combo and one button:

Private Sub Command1_Click()
Dim temp As String
temp = Combo1.Text
Combo1.Clear 'clear context of combo
Combo1.Text = temp 'set text of combo
End Sub

Private Sub Form_Load()
Dim intI As Integer

For intI = 0 To 10 'fill combo with item
Combo1.AddItem "string " & intI
Next intI

Combo1.Text = Combo1.List(0) 'set item1 as text
End Sub



Hope this is what you were asking for

------------------
On Error Goto Bed :0)
anders@zsystemdesign.se

coox
Nov 22nd, 1999, 06:19 PM
Hey OnError, can you tell me how to do that thing where the code is in smaller text with a border above and below? Sorry for being a thicky.

onerrorgoto
Nov 22nd, 1999, 06:41 PM
They have something here that they call ubb-tag's instead of html-tag's.
This page is from FAQ:can I usa html-tag's in my message? http://www.vb-world.net/ubb/ubbcode.html


And my on error goto bed :0)....
is set in my profile and then I check the "Show signature: include ......................... checkbox below.

And the smiling faces can you read about in FAQ:Smilies

Oooop's maybe that was some info that you already knew about ;)

By the way, wasn't there someone here who didn't like our missuse of ... ... etc :)


Good luck

------------------
On Error Goto Bed :0)
anders@zsystemdesign.se



[This message has been edited by onerrorgoto (edited 11-23-1999).]

Joacim Andersson
Nov 22nd, 1999, 09:27 PM
I must say that I think those block quotes of code is totally useless, because when you copy and paste the code into VB all the code end up on one line.

------------------
Joacim Andersson
joacim@programmer.net
joacim@yellowblazer.com
www.YellowBlazer.com (http://www.YellowBlazer.com)

Aaron Young
Nov 22nd, 1999, 09:41 PM
It only seems to be a problem with IE5 it works fine for IE3 & 4.

------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net

MartinLiss
Nov 22nd, 1999, 10:42 PM
I believe that if you click the "Edit" icon on someone's post, you will be able to copy what you need and have the formatting retained. You won't, of course, be able to actually edit the code.

------------------
Marty