473,322 Members | 1,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Using values in non-databound listboxes

Hi,

I have two listboxes (we'll call them LB1 and LB2). LB1 and LB2 are both
populated from data, with the valuemember bound to the ID, and the
displaymember bound to the data's text.

I would like to be able to move the items back and forth between LB1 and
LB2 by using "<-" and "->" buttons, so databinding is ruled out (since you
can't add or remove items to a bound listbox).

My alternative is to populate LB1 manually, by iterating through the
datarows and adding an item for each row. The problem with this is that I
lose the ability to tie an ID to the valuemember (since a non-databound
listbox is indexed [0,1,2,...] rather than value-bound).

Does anybody have a suggestion as to how I can go about achieving this?
I'm not married to the listbox at this point, and any comparable control
will do.
Feb 5 '08 #1
3 986
Scott,

Why can you not use a dataview with a rowfilter to solve your problem.

Cor
Feb 6 '08 #2
On Tue, 05 Feb 2008 13:50:49 -0800, Scott McNair
<sm*****@beachexpress.takethispartout.comwrote:
>Hi,

I have two listboxes (we'll call them LB1 and LB2). LB1 and LB2 are both
populated from data, with the valuemember bound to the ID, and the
displaymember bound to the data's text.

I would like to be able to move the items back and forth between LB1 and
LB2 by using "<-" and "->" buttons, so databinding is ruled out (since you
can't add or remove items to a bound listbox).
But you can add and remove to/from the underlying data source.

I think I might use two BindingList(Of T), one for each listbox. Add
the appropriate records to each. You would probably need to
implements sorting in the BindingLists.

You could also use two DataTables instead.

Feb 6 '08 #3
Jack,

Be aware that with 2 datatables you don't benefit of the binding.
However this can be because of the question an alternative for the OP

Cor
Feb 7 '08 #4

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

Similar topics

1
by: bdinmstig | last post by:
I refined my attempt a little further, and the following code does seem to work, however it has 2 major problems: 1. Very limited support for XPath features Basic paths are supported for...
0
by: obhayes | last post by:
Hi All, Im using classic ASP (3.0) and I have a web farm with 2 webservers (webserver A and webserver B, both windows server 2003). I do not want to store any client specific information on the...
3
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked...
5
by: Colleyville Alan | last post by:
I have built a SQL statement that is trying to loop through the fields of a table that was built from a spreadsheet and hence is "short and fat". So rather than hard-coding, I have a loop from...
8
by: Steve Jorgensen | last post by:
So far, I have never chosen to use GUIDs as Autonumer keys for the tables in my projects, but a recent experience has got me to wondering. I have recently been working on a system that, during...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
1
by: Daveyk0 | last post by:
Hello there, I have a front end database that I have recently made very many changes to to allow off-line use. I keep copies of the databases on my hard drive and link to them rather than the...
19
by: Paul | last post by:
hi, there, for example, char *mystr="##this is##a examp#le"; I want to replace all the "##" in mystr with "****". How can I do this? I checked all the string functions in C, but did not...
15
by: arnuld | last post by:
-------- PROGRAMME ----------- /* Stroustrup, 5.6 Structures STATEMENT: this programmes *tries* to do do this in 3 parts: 1.) it creates a "struct", named "jd", of type "address". 2. it...
71
by: desktop | last post by:
I have read in Bjarne Stroustrup that using malloc and free should be avoided in C++ because they deal with uninitialized memory and one should instead use new and delete. But why is that a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.