473,657 Members | 2,316 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Listbox Loop

OuTCasT
374 Contributor
I have bound a listbox with a dataTable

Now i want to move the values from the listbox to another listbox.
i have changed the selectionMode of the listbox to multiple.

So they choose multiple items and they get moved over to the other listbox.

Expand|Select|Wrap|Line Numbers
  1. for each item in listbox1.selecteditems
  2. listbox2.items.add(item)
  3. next
i get system.data.dat arowview in the listbox2

how could i replace that with the actual value ?
Jul 10 '09 #1
1 2150
OuTCasT
374 Contributor
Expand|Select|Wrap|Line Numbers
  1. sqlCon.Open()
  2.             sqlAdapter = New SqlDataAdapter(sqlCom)
  3.             sqlTable = New DataTable
  4.             sqlAdapter.Fill(sqlTable)
  5.             Dim s As String
  6.             For i = 0 To sqlTable.Rows.Count - 1
  7.                 s = sqlTable.Rows(i)("emailaddress").ToString
  8.                 ListBox1.Items.Add(s)
  9.             Next
  10.             sqlCon.Close()
Jul 10 '09 #2

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

Similar topics

5
2461
by: Melissa Cowan | last post by:
I am using Access 2000. I have the Developer's handbook and got the code for the mulit select listbox from there. It sends the selected value to another listbox, lstselected. What I need to do is loop through there and add each item to a table. I can add the other info fromt he form to a table, just not the otems in the listbox. It only shows as 0. I tried using the varItem and it told me that the action is not supported. I'm a bit rusty...
7
66799
by: yue | last post by:
Hi, How do I loop through listbox items? Thanks, yue
2
2911
by: collie | last post by:
Hi, I have 2 listboxes. The first gets populated from the db as soon as the page loads. The second listbox get populated based on the user's selection from the first listbox. However, currently the code is such that with each selection there is a postback. We want to avoid it using filter and javascript. I am not using ADO.NET but adodbc and no datagrids or datasets (please don't tell me that i should as my boss clearly doesn't want...
4
5094
by: Bob P. | last post by:
Hello, I have a page with: * two side-by-side asp:listboxes and two arrow asp:buttons allowing users to add/remove email addresses between them -- very much like Outlook, where you have the address book on the left, and you build the message recipients on the right. * an asp:button that, when clicked, fires off some code to create and send the mail message
4
1851
by: collie | last post by:
HI, I need to populate 2 listboxes from a db. When the page loads then the first listbox needs to be populated and based on selection from that listbox the second listbox needs to be populated accordingly with the matching items. However, my boss doesn't want the page to do a postback once an item from the first listbox is selected. also, he doesn't want to use ado.net but classic ado. He wants to use jscript. I am writing my code in...
2
3835
by: tangokilo | last post by:
Hello and thanks for your help, I have the following Listbox created in VisualStudio 2003 designer, desiring to select multiple entries from that list: ------------------------------- ListBoxUser.Location = New System.Drawing.Point(16, 240) ListBoxUser.Name = "ListBoxUser" ListBoxUser.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended ListBoxUser.Size = New System.Drawing.Size(136, 147) ListBoxUser.TabIndex = 6
0
1175
by: Tom | last post by:
OK, here's a wierd one... I have a listbox, which I fill with strings (in my case, file names). I normally load this via a loop, adding each item to the list box in the loop. I put lb.BeginUpdate before the start of the loop, and lb.EndUpdate at the conclusion of the loop. Here's the wierd part: If there is only ONE line loaded into the list box, the list box SHOWS UP AS BLANK! It says there is 1 item in the box, but it never shows up on...
1
2077
by: lance2001 | last post by:
Hi, After viewing the entire Visual Basic 2005 Express Edition for Beginners video series, I have begun building a database driven application that will make use of listbox1 (multi-select) determining what shows up in listbox2 (multi_select), which determines listbox3, etc.... Each each listbox is populated from a different table in the same database. The databinding examples given in the video seem to leave no way for a
0
5567
by: raypjr | last post by:
Hi everyone. I'm new here and hope I can get a little advice on how to list my array into a ListBox. I have my structure and array of structures. I need help with a For Loop that will list the particular elements in the List Box. Any suggestions on how to best write this? ' I create a Structure with members ' place, title, author, publisher, price, description, lastweek, weeksonlist Structure bestseller Public place...
2
1794
by: rn5a | last post by:
A ListBox lists all the files & directories existing in a directory on the server. If an item in the ListBox happens to be a directory, then the name of the directory is appended with the text . Similarly, if an item in the ListBox happens to be a file, then the name of the file is appended with the text . Assuming that the ListBox lists 2 directories & 3 files, this is how the ListBox would look like: MyDir1 MyDir2 File1.aspx
0
8323
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,...
0
8838
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6176
isladogs
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...
0
5638
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();...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2740
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
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
bsmnconsultancy
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...

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.