In my main form code, I've added this:
public static ShoeStyle selectedStyle;
ShoeStyle
is the name of an enum I have in a class. I want selectedStyle
to contain the name of whatever I select in my combo box. Like this
private void cmbShoeList_SelectedIndexChanged(object sender, EventArgs e)
{
selectedStyle = (ShoeStyle)cmbShoeList.SelectedValue;
}
But when I run the program, it gives me the error:
specified cast is not valid.
I'm not sure how I can fix this. I've heard of the term cast before but am unfamiliar with it