How do I convert a string to an int etc?
In general, when you want to convert from one type to another, the first class to look at is System.Convert. It has a load of static methods which are likely to help you. If you’re converting from a String, you could also check whether the type that you want to convert to has a Parse method or something similar – for instance, I usually use DateTime.ParseExact to convert from a String to a DateTime.