Solved

listbox1.Items.ValueFromIndex problem ?

Posted on 2003-12-10
3
940 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
  • 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

746 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now