|
-
Nov 22nd, 1999, 06:29 PM
#1
Thread Starter
Hyperactive Member
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...
-
Nov 22nd, 1999, 07:07 PM
#2
Hyperactive Member
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:
Code:
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)
[email protected]
-
Nov 22nd, 1999, 07:19 PM
#3
Fanatic Member
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.
-
Nov 22nd, 1999, 07:41 PM
#4
Hyperactive Member
-
Nov 22nd, 1999, 10:27 PM
#5
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
[email protected]
[email protected]
www.YellowBlazer.com
-
Nov 22nd, 1999, 10:41 PM
#6
It only seems to be a problem with IE5 it works fine for IE3 & 4.
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
Nov 22nd, 1999, 11:42 PM
#7
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|