Newbie: How to compare strings?

G

Guest

Hi,

On my drop down list control, i am trying to set the
DropDownList1.SelectedValue property to the selected string value. In my
example, my DropDownList1 control contains three colors:

- Carlos
- Mike
- Susan

However, if i try to set the DropDownList1.SelectedValue = "carlos"; i get
the following error: "Exception: Specified argument was out of the range of
valid values. Parameter name: carlos." This is b/c "Carlos" != to "carlos".

I realize that i can convert all the drop down list controls values to
uppercase, however, i'd like to keep the names as they are entered by the
user.

Is there anyway to compare these strings, ignoring any differences in
uppercase or lowercase?

Thanks!
 

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

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top