Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 02-14-2006, 11:41 AM   #1 (permalink)
rikb53
Registered User
 
Join Date: Jan 2006
Posts: 29
rikb53 is on a distinguished road
loop thru listbox

guys ive got a simple question that alludes me for right now.

if i iterate thru the elements of a list box like below::::
txtTo is the listbox.


Dim myEmailToList As String
Dim i As Integer
For i = 0 To txtTo.Items.Count - 1
myEmailToList += txtTo.Items.IndexOf(i)
Next

i know this is simple - i've never had to loop thru a listbox before.
thanks for any help on this
rik
rikb53 is offline   Reply With Quote
Old 02-14-2006, 12:39 PM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,475
sde is on a distinguished road
i don't think you finished asking your question. if that code isn't working i could take a stab. maybe add a ToString() after txtTo.Items.IndexOf(i)
sde is offline   Reply With Quote
Old 02-14-2006, 12:42 PM   #3 (permalink)
rikb53
Registered User
 
Join Date: Jan 2006
Posts: 29
rikb53 is on a distinguished road
you are correct it wasnt finished. but as my luck would have it. i somehow figured it out and concatenating a semi colon at the end to separate the email addresses. i dont know why the "indexOf" property didnt work

thanks a bunch

rik

Dim myEmailToList As String
Dim j As Integer
For j = 0 To txtTo.Items.Count - 1
myEmailToList += txtTo.Items(j).Value & ";"

Next j
rikb53 is offline   Reply With Quote
Old 02-14-2006, 12:53 PM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,475
sde is on a distinguished road
great! thanks for posting the solution.
sde is offline   Reply With Quote
Old 02-17-2006, 06:42 PM   #5 (permalink)
iowacb4600f4guy
Registered User
 
Join Date: Feb 2006
Location: Clive, iowa
Posts: 3
iowacb4600f4guy is on a distinguished road
Send a message via AIM to iowacb4600f4guy
Quote:
Originally Posted by rikb53
you are correct it wasnt finished. but as my luck would have it. i somehow figured it out and concatenating a semi colon at the end to separate the email addresses. i dont know why the "indexOf" property didnt work

thanks a bunch

rik

Dim myEmailToList As String
Dim j As Integer
For j = 0 To txtTo.Items.Count - 1
myEmailToList += txtTo.Items(j).Value & ";"

Next j
The "IndexOf" property didn't work, because the "indexof" property returns a value that shows you the "Index" of the value you you place in the ()'s
iowacb4600f4guy is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't get loop to work rockybalboa Java 5 03-20-2005 03:54 PM
listbox sureshkumar_kc MS Technologies ( ASP, VB, C#, .NET ) 5 10-15-2004 01:41 AM
Breaking out of external loop agh Standard C, C++ 7 04-30-2003 08:03 PM
Loop in scripts causing Crashs mixingsoup PHP 2 12-01-2002 08:37 PM
the endless loop loop loop loop loop loop ... abc123 All Other Coding Languages 2 08-14-2002 03:43 PM


All times are GMT -8. The time now is 07:11 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting