.net - How to pass enum parameter from Combobox to another class (winform) -


I need help passing the value value selected from the second value (from cbShowVal). Class A {// Enum: public enum myDisplayOptions {Test1, Test2, Test3} // combox binding: cbShowVal.DataSource = Enum.GetValues ​​(typeOf (DisplayOptions)); } Class B {private int newVal = 0; Public Ink Gateenoff's Asits (My DisplaysOpSH) {Sweth (CA) {Case myDisplayOptions.Test1: newVal = 100; break; Case myDisplayOptions.Test2: newVal = 200; break; Case myDisplayOptions.Test3: newVal = 300; break; } New Well Return; }}

you convert the string back to enum

  myDisplayOptions option = (myDisplayOptions) Enum.Parse (type (myDisplayOptions), cbShowVal.SelectedValue);   

and then

  bb = new b (); Int. Seats = B.GetnamAffsat (option);    

Comments