iccaros Posted October 14, 2006 Report Share Posted October 14, 2006 say I have an enum declared like soenum lookup {a=1,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}now I have an user enter a string (say a)so string mystring = a;how do I take string a and get the value from the enum lookupI've tried int Iplace = (int)(lookup)mystring;but that failsif I change it to a char then It passes the value of the char not the char. Quote Link to post Share on other sites
jcl Posted October 14, 2006 Report Share Posted October 14, 2006 (edited) Something likeint n = (int)Enum.parse(typeof(lookup), mystring);? Edited October 14, 2006 by jcl Quote Link to post Share on other sites
iccaros Posted October 14, 2006 Author Report Share Posted October 14, 2006 Thank you, Thank you, Thank you..I tried that before severl times but was missing the "," between (lookup) and mystringso it keeped telling me I had an invalud overload of system.type which ment nothing to me, except I was wrong.. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.