473,396 Members | 1,748 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,396 software developers and data experts.

how to add an item from one list box to another??

106 100+
one listbox1 displays information from one table1, listbox2 displays information from another table2.
I want to add an item from listbox2 to listbox1 using a button. (table1 will be effected, table2 stays the same )

How can i do this.

please help?
Nov 20 '06 #1
5 4807
Killer42
8,435 Expert 8TB
one listbox1 displays information from one table1, listbox2 displays information from another table2.
I want to add an item from listbox2 to listbox1 using a button. (table1 will be effected, table2 stays the same )

How can i do this.

please help?
I'm not expert in this area, but I'd guess what you will need to do behind the button is copy the record from table2 to table1, then use "ReQuery" on listbox1.
Nov 20 '06 #2
tara99
106 100+
I'm not expert in this area, but I'd guess what you will need to do behind the button is copy the record from table2 to table1, then use "ReQuery" on listbox1.
can you clarify this abit.

I have two list boxes.
Listbox1 holds some data from query of table1 for a particular selection of the combobox.
listbox2 holds also some data from table2 independant of any selection.

What I want is that when I select an item from listbox2 and hit the OK button, it should be displayed in the listbox1(appened), also those item should also be added into the table1 for that particular selction from combobox.

Can you help
Nov 22 '06 #3
MMcCarthy
14,534 Expert Mod 8TB
can you clarify this abit.

I have two list boxes.
Listbox1 holds some data from query of table1 for a particular selection of the combobox.
listbox2 holds also some data from table2 independant of any selection.

What I want is that when I select an item from listbox2 and hit the OK button, it should be displayed in the listbox1(appened), also those item should also be added into the table1 for that particular selction from combobox.

Can you help
Tara you can't do this as listbox1 is based on a query. Normally to add something to a listbox you have to add it to the relevant table in the query. Then requery the listbox.

What are you trying to do and why is just as important as the physical action you are trying to code. Explaining that will get you a more accurate answer than I want to move something from one listbox to another. It's hardly ever that simple. So explain your thinking and we'll take it from there.

Mary
Nov 22 '06 #4
For i = 0 To lst1.ListCount - 1
If lst1.Selected(i) Then
lst2.AddItem lst1.Column(0)
End If
Next i
Dec 22 '06 #5
Killer42
8,435 Expert 8TB
For i = 0 To lst1.ListCount - 1
If lst1.Selected(i) Then
lst2.AddItem lst1.Column(0)
End If
Next i
Hi andy. Just a quick tip on posting, for future reference. If you want the indenting to work (it can be really frustrating the way it just disappears, huh), you have to put [c o d e] tags around your code. Like this...
Expand|Select|Wrap|Line Numbers
  1. For i = 0 To lst1.ListCount - 1
  2.   If lst1.Selected(i) Then
  3.     lst2.AddItem lst1.Column(0)
  4.   End If
  5. Next i
Dec 23 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

25
by: Matthias | last post by:
Hi, I am just reading that book by Scott Meyers. In Item 4 Meyers suggests to always use empty() instead of size() when probing for emptyness of STL containers. His reasoning is that size()...
2
by: VR | last post by:
I have a form with a list view control, a button control and a main menu with menuDelete item. Any time I am handling a button click event or menuDelete click event I call DeleteItem() function...
7
by: Grant Schenck | last post by:
Hello, I have a ListBox control on a form. I add members of a class to the Items collection. They show up and I can select them. The text shown is from my classes ToString override. Now,...
0
by: luckybird | last post by:
I succeeded in obtaining a CListCtrl item info using HitTest() when the List Ctrl is owned by my current thread. But when I tried HitTest an item of a List Ctrl owned by other threads such as...
18
by: JohnR | last post by:
From reading the documentation, this should be a relatively easy thing. I have an arraylist of custom class instances which I want to search with an"indexof" where I'm passing an instance if the...
7
by: Miguel E. | last post by:
Hi, I've been (self) studying Python for the past two months and I have had no background in OOP whatsoever. I was able to write an interactive program that randomly selects an item from a...
10
by: tkpmep | last post by:
For any list x, x.index(item) returns the index of the FIRST occurrence of the item in x. Is there a simple way to identify the LAST occurrence of an item in a list? My solution feels complex -...
4
by: SM | last post by:
Hello, I have an unordered list similar to this one: <ul id=list> <li onclick="addParagraph(0)">Item 1</li> <li onclick="addParagraph(1)">Item 2</li> <li onclick="addParagraph(2)">Item...
5
by: Bart Steur | last post by:
Hi, What's the best way to programmaticly select (click) another listview Item after removing the selected/focused one. using VB2005 Express. Thanks Bart
8
by: Ratko | last post by:
Say you have something like this: for item in myList: del item Would this actually delete the item from the list or just decrement the reference counter because the item in myList is not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
tracyyun
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...

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.