NAlvar
May 19th, 2004, 05:07 AM
Hello,
I', attempting to convert a string description into a font and I'm successful except for updating the style.
I'm using a type converter, here is the code:
Dim tobj As Type = obj.GetType
Dim pi As PropertyInfo = tobj.GetProperty("Font")
Dim propvalue as string = "Tahoma;10"
Dim valueobject As Object = TypeDescriptor.GetConverter(pi.PropertyType).ConvertFromString(propvalue)
With this propvalue, it works. ;) The valueobject created is a font. But I can't define the style of the font, because if I assign the propvalue as follows:
Dim propvalue as string = "Tahoma;10;Bold"
an exception is throwed:
Run-time exception thrown : System.ArgumentException - Failed to parse Text("Tahoma;10;Bold") expected text in the format "name, size[units[, style]]".
Does anyone know what text should be into propvalue?
Thanks in advance.
NAlvar
I', attempting to convert a string description into a font and I'm successful except for updating the style.
I'm using a type converter, here is the code:
Dim tobj As Type = obj.GetType
Dim pi As PropertyInfo = tobj.GetProperty("Font")
Dim propvalue as string = "Tahoma;10"
Dim valueobject As Object = TypeDescriptor.GetConverter(pi.PropertyType).ConvertFromString(propvalue)
With this propvalue, it works. ;) The valueobject created is a font. But I can't define the style of the font, because if I assign the propvalue as follows:
Dim propvalue as string = "Tahoma;10;Bold"
an exception is throwed:
Run-time exception thrown : System.ArgumentException - Failed to parse Text("Tahoma;10;Bold") expected text in the format "name, size[units[, style]]".
Does anyone know what text should be into propvalue?
Thanks in advance.
NAlvar