Saving a pen.dashstyle

I am trying to come up with a way for users to change properties of a link. I am stuck on the dashstyle property.
I have populated a dropdown with the style options, solid, dash, etc. and my edit panel successfully shows the current style because I do something like :
linkLineStyleDropDownList.SelectedValue = link.Pen.DashStyle.ToString();
however, I am having a bugger of a time trying to figure out how to go the other way:
link.Pen.DashStyle = linkLineStyleDropDownList.SelectedValue.ToString()
tells me I can’t turn a string into a dashstyle which makes sense.
Do I have do a switch statement comparing the possible string values or is there a way to do a cast? I am hoping to save the string value of the dashstyle in a database for later restoration as well.
I need to do the same thing with link style (orthogonal, bezier, etc)
thanks

Well, System.Drawing.Drawing2D.DashStyle is an enum, not a string.
Secondly, you might need to handle the DashStyle.Custom value too, where the Pen.DashPattern is an array of floats.

Thanks Walter. I actually had no idea it was an enum or what an enum is. But I have done some research and tried to educate myself.
An enum is generally an int value. So I have changed my table to store int values. For those who may search for this topic someday you simply do something like:
int x = (int)link.Pen.DashStyle
I also use this (with a .ToString()) to get the droplist to show the current value.
that gives you an int value to store. Then to get it back you use this casting statement: (this is actually how I set the value of the DashStyle after my update panel has closed)
int ds = Convert .ToInt32(linkLineStyleDropDownList.SelectedValue.ToString()) ;
link.Pen.DashStyle = (System.Drawing.Drawing2D.DashStyle)ds;
What I was missing was the System.Drawing.yadayada in the last line.
Thanks again for the help.
Mark

Actually, you might also find the WriteShapeData and ReadShapeData methods of GraphML in the OrgCharter sample useful.
Although now that I look at it, it doesn’t handle custom dash style either. That would be trivial to extend by adding another attribute whose value was a list of numbers that would be the array of floats.
In WriteShapeData something like:
if (ds == DashStyle.Custom)
WriteData(“pendashpattern”, WriteAttrVal(null, pen.DashPattern));
and then in ReadShapeData something like:
} else if (attr == “pendashcustom”) {
Pen oldpen = shape.Pen;
Pen pen = new Pen((oldpen != null ? oldpen.Color : Color.Black), (oldpen != null ? oldpen.Width : 1));
pen.DashStyle = DashStyle.Custom;
pen.DashPattern = SingleArrayFromString(val, new float[2] { 4, 4 });
shape.Pen = pen;
}
Note that WriteData is a helper method that is specific to GraphML. Assuming you can define whatever XML schema you want, you’ll want to keep things simple by having the various pen properties as attributes on a single element, not as separate elements as is required in GraphML. So, as you can see it the other GoXml samples, you’ll want to just call WriteAttrVal passing it an attribute name instead of null just to get the string representation of that type of value.