Solved

listbox1.Items.ValueFromIndex problem ?

Posted on 2003-12-10
3
949 Views
Last Modified: 2012-06-21
Hello Experts,
i have a listbox, there are email addresses in it as an items,
i want to take the value from a listbox item, and set it as a string which i declared earlyer let's say "email". toEmail is an integer that declares which listbox item i will use.
The problem is that if i have bbh2k3@yahoo.com in the listbox i get bh2k3@yahoo.com as a value of the email string.
It eats one character... how to fix that ?
My Code Is:
email := tolistbox.Items.ValueFromIndex[toemail];

Thanks in advance!
0
Comment
Question by:bbh2k3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 26

Accepted Solution

by:
Russell Libby earned 500 total points
ID: 9912394

The ValueFromIndex is useful when dealing with name/value pairs, which you are NOT using. What you should be using is:

email:=tolistbox.Items[toemail];

This will return the whole string back.

Regards,
Russell

0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 9912405
how looks your listboxentries?
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 9912429
well, did some tests

if your entries are like

blabla=xxx

then it works correct,
but if your entry is like

xxx

then the first letter is skipped

-> conclusion
use rllibbys suggestion

meikl ;-)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question