if (!lstFieldData.Items.Contains(ItemValue))
MessageBox.Show(ItemValue + "Item not found.");
Above code is to get the list of items that is not in the list. Now i want to check this with ignoring the case. How do i?
if (!lstFieldData.Items.Contains(ItemValue))
MessageBox.Show(ItemValue + "Item not found.");
Above code is to get the list of items that is not in the list. Now i want to check this with ignoring the case. How do i?
If your lstFieldData consists of only capital letters or lower letters you can use .ToUpper() or .ToLower().
lstFieldData
A
B
C
D
if (!lstFieldData.Items.Contains(ItemValue.ToUpper()))
MessageBox.Show(ItemValue + "Item not found.");
lstFieldData
a
b
c
d
if (!lstFieldData.Items.Contains(ItemValue.ToLower()))
MessageBox.Show(ItemValue + "Item not found.");
if (strCompare.Equals("testcompare", StringComparison.InvariantCultureIgnoreCase))
{
///
}
try this