Posts Tagged ‘Conversion’
Convert color from string
To convert a color from a string use the ColorConverter class but this can be access through TypeConverter class;
-
Dim myColor as Drawing.Color
-
-
Dim clor As System.ComponentModel.TypeConverter = System.ComponentModel.TypeDescriptor.GetConverter(GetType(Drawing.Color))
-
-
myColor = clor.ConvertFromString("Blue")
MyColor variable is now ready to use.
String to Numeric Conversion
Data Conversion in c# .net
| Numeric Type | Method |
|---|---|
| decimal | Convert.ToDecimal(String) |
| float | Convert.ToSingle(String) |
| double | Convert.ToDouble(String) |
| short | Convert.ToInt16(String) |
| long | Convert.ToInt64(String) |
| ushort | Convert.ToUInt16(String) |
| uint | Convert.ToUInt32(String) |
| ulong | Convert.ToUInt64(String) |
How to: Convert a string to an int (C# Programming Guide)