I have this piece of code in Listview-SelectedIndexChanged Event.
The problem is, when I click the item for the first time, it runs successfully. However, if I click the same item twice, it does nothing, it only does if I click in a different item.
The item is focused, but I can't get the focus out of him without giving me "errors" (because it duplicates the code).
Tried:
string get_gold = Regex.Replace(word, "[^0-9]+", string.Empty);
if (gold >= Convert.ToInt32(get_gold))
{
gold -= Convert.ToInt32(get_gold);
}
else
{
MessageBox.Show("Error!");
}
The problem is, when I click the item for the first time, it runs successfully. However, if I click the same item twice, it does nothing, it only does if I click in a different item.
The item is focused, but I can't get the focus out of him without giving me "errors" (because it duplicates the code).
Tried:
listview1.SelectedIndices.Clear(); listview1.SelectedItems.Clear();