How can I display the items in a collection in a listbox? Then, what is the
code to remove an item from the collection when the item is selected in the
listbox ?
Thanks for all help!!
Maria 4 6443
Maria wrote: How can I display the items in a collection in a listbox? Then, what is the code to remove an item from the collection when the item is selected in the listbox ?
set the RowsourceType property of the listbox to "value list". Have a
function that takes a Collection and returns its members in a properly
separated string; assign that to the RowSource property of the listbox
If you are sure you want to do this on click (when the user navigates
with the keyboard, the Click fires for every row passed, which I
wouldn't expect):
Set the onClick property for the listbox to [Event Procedure] and write
an event handler that removes the item from the collection. Re-filling
the list is an option.
--
Bas Cost Budde, Holland http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Thank you for responding!
How do I do the following ---
<< function that takes a Collection and returns its members in a properly
separated string; >>
<< event handler that removes the item from the collection. Re-filling the
list is an option.>>
Maria
"Bas Cost Budde" <b.*********@he uvelqop.nl> wrote in message
news:cp******** **@news2.solcon .nl... Maria wrote: How can I display the items in a collection in a listbox? Then, what is
the code to remove an item from the collection when the item is selected in
the listbox ?
set the RowsourceType property of the listbox to "value list". Have a function that takes a Collection and returns its members in a properly separated string; assign that to the RowSource property of the listbox
If you are sure you want to do this on click (when the user navigates with the keyboard, the Click fires for every row passed, which I wouldn't expect):
Set the onClick property for the listbox to [Event Procedure] and write an event handler that removes the item from the collection. Re-filling the list is an option.
-- Bas Cost Budde, Holland http://www.heuveltop.nl/BasCB/msac_index.html I prefer human mail above automated so in my address replace the queue with a tea
Maria wrote: << function that takes a Collection and returns its members in a properly separated string; >>
It does depend a bit on what exactly is in the Collection.
Air code:
function EnumColl(coll as collection)as string
dim item as variant
dim cRes as string
for each item in collection
cres=cres & item.value & ";"
next
enumcoll=left(c res,len(cres)-1)
end function
<< event handler that removes the item from the collection. Re-filling the list is an option.>>
Form is open in design view? Good. Select the listbox, view Properties,
tab Events; choose [Event Procedure] for onClick.
Click the three dot button. If you are presented with three options,
choose the one similar to "write code" (what was that again?)
Put this inside:
yourcollection. remove yourlistbox.lis tindex
If it doesn't remove the right one, you might have to put
yourcollection. remove yourlistbox.lis tindex +1
the optional part is then
yourlistbox.row source = enumcoll(yourco llection)
--
Bas Cost Budde, Holland http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Maria wrote: How can I display the items in a collection in a listbox? Then, what is the code to remove an item from the collection when the item is selected in the listbox ?
Thanks for all help!!
Maria
Look at the RowSourceType Property in help via the Visual Basic IDE.
While your at it, look at the members of VBA.Collection in the Object
Browser which is available from the View menu of the IDE. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: RandyS |
last post by:
I know how to do it in VB6, but that doesn't work in .NET. I am trying to
select single or multiple items to load into a collection.
--
..NET Developer in Training
|
by: xzzy |
last post by:
I have an app that uses a listbox to display program status messages, and a
public function to be used by the solution to update the listbox.
I do not know how to make the listbox public so it can be updated by that
function.
public class frmMain : System.Windows.Forms.Form{
public System.Windows.Forms.ListBox listBox1;
|
by: Prasad |
last post by:
Hey All,
I am having a little trouble with the ListBox's Items collection property. I
am populating the ListBox with data contained in an SQL table using
SQLDataAdapter and DataSet.
I have set the "DataSource", "DisplayMember", and "ValueMember" properties
of the ListBox correctly like below:
lbTechnician.DataSource = TechnicianDataSet.Tables;
|
by: Valerian John |
last post by:
I have a ListBox webcontrol on an aspx page. Items are added to the
ListBox using client-side code. However, when the page is posted back the
items are missing/not available. (It is like the page does not know the
items were added client-side.)
TIA,
Val
|
by: Ryan Ternier |
last post by:
Thanks for the previous help guys!
I got my list box issue working, but now i'm trying to loop through all the
items in my page.
I want to find each listbox, once I do i strip the ID down to find what I
need so I can populate a DB.
lstTest is dim'd as a ListBox, and I thought I could just do:
| |
by: Stimp |
last post by:
I have a listbox of values that I populate from a database.
I want the user to be able to re-order the list
(by first selecting an item and then clicking 'up' or 'down' buttons)
and then save the list back to the database.
First of all, I implemented the re-ordering through client-side
javascript, which worked great (also it didn't require a postback every
time an item was re-ordered). For testing purposes, I'm outputting the
contents...
|
by: Baren |
last post by:
Hi!
I have a generalized Stored Procedure to get the listbox items in a
datareader.Then i am binding the datareader to the listbox. For different
pages and different conditions i need to hide and show some the items
returned by the datareader.
Can anyone help me out to solve this issue.
Thanks in adavnce.
|
by: Dany P. Wu |
last post by:
Hi everyone,
One of my Windows forms contain two listbox controls, with Add and Remove
buttons between them.
The idea is to allow users to select multiple items from one ListBox, click
the Add button, and the selected items will move to the second ListBox.
I've been trying to use the ListBox.SelectedObjectCollection with no
success. It sounds like the logical thing to use but I can't seem to find
|
by: Academia |
last post by:
(If you've seen this in the drawing NG, sorry. I inadvertently sent it
there.)
I have a listbox populated with Objects.
The Class has a String field that ToString returns.
I assume that is what the ListBox uses for its display. Correct?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |