compare string with combobox items

Posted on 2006-06-05
Last Modified: 2007-12-19
hi experts,
I've a little problem which seems to be easy but I can't found the clue. I want to check if a string is an item from an combobox?

I tried :

var i:integer;
 for i:=0 to combobox1.Items.Count do
    if  combobox3.Items.Text=s then
// do something

but won't work. Thanks for help
Question by:A. Cristian Csiki
    LVL 28

    Accepted Solution

    if combobox3.items.indexof(s)>-1 then
    // exists
    // does not exist
    LVL 11

    Author Comment

    by:A. Cristian Csiki
    thanks a lot, it fits :)
    and if I want to found the item can I make it visible in combobox?
    ex: I found data as the 4-th item of my combobox, can I set the combobox to itemindex 5 to display my item found?
    LVL 28

    Expert Comment

    f i>-1 then
    LVL 11

    Author Comment

    by:A. Cristian Csiki
    perfect! thanks

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    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…
    In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…

    759 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

    10 Experts available now in Live!

    Get 1:1 Help Now