CarData1.TypeCar = (Class_Sample.TypeCar)Enum.Parse(typeof(Class_Sample.TypeCar), listBox2.SelectedItem.ToString());

// this is your Enum       //this is your Enum Converter

Description 

  1. above coding i use for my Enum
  2. this coding also can be use for this error ” Cannot Implicitly type ‘string’ to ‘enum’ “.
  3. this coding mostly use during writing Open and Save button.

Leave a Reply