ListView

M

mick

Been messing around with the ListView control today and noticed
that given that I have items

"Item 1"
"Item 2"
"Item 3"

in the list, when I use the ListView.FindItemWithText() and pass in an empty
string it returns the first item rather than null. Is this how it should be
and if so
why?

mick
 
P

Peter Duniho

mick said:
Been messing around with the ListView control today and noticed
that given that I have items

"Item 1"
"Item 2"
"Item 3"

in the list, when I use the ListView.FindItemWithText() and pass in an empty
string it returns the first item rather than null. Is this how it should
be and if so why?

Yes, it's supposed to work that way. Because FindItemWithText() isn't a
string equality operation, but rather a string "begins with" operation.
And of course, every string starts with "" (i.e. you can represent any
given string in the form "" + <some other string>).

Pete
 
M

mick

Peter Duniho said:
Yes, it's supposed to work that way. Because FindItemWithText() isn't a
string equality operation, but rather a string "begins with" operation.
And of course, every string starts with "" (i.e. you can represent any
given string in the form "" + <some other string>).

Thanks for clearing that up.

mick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top