472,354 Members | 1,855 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,354 software developers and data experts.

clearing a listbox

Hello
I'm keeping this list busy! :
Okay, now I'm trying to clear a listbox
The way I have it set up, the user can either enter a value into a textbox, then hit a button, and 1 specific record is shown in the listbox. Or, the user can just hit the button (leaving the textbox blank) and all possible records are retrieved and are displayed in the listbox. These methods work great
But, when I want to switch between the two...for example, if I retrieve all records, then enter a value to specify one, I need the listbox to clear, then just show the single selected item.
And, if a user enters a value - the listbox only shows this value, but if they enters another value, the original value stays there, it won't replace itself with the new value
The code that I am using is

listbox.datasource = Nothin
listbox.items.clear(

This isn't working for me...

Thanks in advance
Ambe

Nov 20 '05 #1
2 8254
* "=?Utf-8?B?YW1iZXI=?=" <an*******@discussions.microsoft.com> scripsit:
I'm keeping this list busy! :)


No problem, you are welcome. Nevertheless, please break lines after a
certain number of characters (~76), some newsreaders do not wrap long
lines automatically and the users (including me) will have to scroll
horizontally to read your message. Thank you!

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Website Address Changed!
Nov 20 '05 #2
Calling clear() works for me, but you might try calling refresh after clear:

ListBox1.Items.Clear()

ListBox1.Refresh

"amber" <an*******@discussions.microsoft.com> wrote in message
news:27**********************************@microsof t.com...
Hello.
I'm keeping this list busy! :)
Okay, now I'm trying to clear a listbox.
The way I have it set up, the user can either enter a value into a textbox, then hit a button, and 1 specific record is shown in the listbox.
Or, the user can just hit the button (leaving the textbox blank) and all
possible records are retrieved and are displayed in the listbox. These
methods work great. But, when I want to switch between the two...for example, if I retrieve all records, then enter a value to specify one, I need the listbox to clear,
then just show the single selected item. And, if a user enters a value - the listbox only shows this value, but if they enters another value, the original value stays there, it won't replace
itself with the new value. The code that I am using is:

listbox.datasource = Nothing
listbox.items.clear()

This isn't working for me....

Thanks in advance!
Amber

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: amber | last post by:
Hello. Can someone tell me what I may be doing wrong here? I'm using the code (lboxRP is a listbox): Dim newRPindex As Integer newRPindex = Me.lboxRP.FindString(RP)...
2
by: Peter Bailey | last post by:
I have a function courtesy of the newsgroup that clears the list box. I would like to now set the listbox back to its initial state where you can see the first item in the list. The same goes for a...
3
by: Rosanne | last post by:
Is there a way to clear the SelectedIndex of a listbox when the browser's back button is clicked? I have a page that contains a server side list box with AutoPostBack = True. When the user...
1
by: nazir.atif | last post by:
How does one clear a listbox, of say, 1 column?
2
by: John | last post by:
Hi How can I clear the selection from a multi-select list via code? Thanks Regards
7
by: ljungers | last post by:
Have Form-1 with 3 text boxes and 1 command button. With any of the 3 boxes filled out and button is clicked, a Macro is performed that Opens a Query that has a WHERE clause that uses the 3 test...
2
by: rsteph | last post by:
I've got a form set up that has a series of textboxes to enter employee info, with a listbox at the bottom listing all the employees with their title (to make it easier to find employees to edit...
3
by: Angel Blue01 | last post by:
I have a form with a binding navigator that draws from a database via drag-and-drop-created controls. I'm filling a listbox with the results of a query. The listbox contains data related to the...
1
by: sweetiecakes | last post by:
Hi I have a ListBox which is binded to a dataSet. When I need to refresh this dataSet, it works, but the old entries don't get removed from the listbox. Items.Clear() doesn't work when a...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
1
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
0
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.