use TypeConverter.ConvertToString(aType)

  • Thread starter Thread starter Mr. X.
  • Start date Start date
M

Mr. X.

How can I pass a parameter to TypeConverter.convertToString, when aType is,
I.e., Color ?
If I declare
(When I.e the property that is searched is of type : color)
dim c as color
dim s as string
dim converter as typeConverter
.....

c = Red
s = converter.ConvertToString (c )
The above works !

but when I do :
dim c
c = color.red
s = converter.ConvertToString( c)
the above doesn't work !
I didn't find a way to pass the correct type to converter.ConvertString
I cannot declare a variable, which is known.
I have tried something like
c = tryCast(property.getValue(myControl, nothing), property.propertyType) '
this is not compiled !!!

Thanks :)
 
Also,
I see that :
c.name = "Control" (when dim c)
I cannot change the name.
Where c is Color (dim c Color), c.name = "Color".
If I could change the name (or make new object, which its name is "Color".
Color is dynamic, and only a sample.

Thanks :)
 
Major problem is that System.Reflection.propertyInfo.getValue(myControl,
nothing) returns the value correctly, except that the name doesn’t return
correctly for some objects
(such as Color).
 
Ignore.
My mistake.
Name is OK.

Now question is this :
BackColor is of type : Color.

The default of button.backColor = Control.

Control is not a Color (it is some virtual name).
How can I translate it anywhere to Color.
(The same for simmiliar properties, that act the same).

Thanks :)
 
Am 22.06.2010 14:14, schrieb Mr. X.:
Now question is this :
BackColor is of type : Color.

The default of button.backColor = Control.

Control is not a Color (it is some virtual name).
How can I translate it anywhere to Color.
(The same for simmiliar properties, that act the same).

Dim c as color = Color.FromName("Control")
 
Thanks a lot for you kindness.
I succeed saving and retrieving my objects, and learn a lot from the last
threads.

Thank you.
:)
 
Am 23.06.2010 08:11, schrieb Mr. X.:
Thanks a lot for you kindness.
I succeed saving and retrieving my objects, and learn a lot from the last
threads.

Thank you.
:)


I've learned a lot, too.
:-)
 
Back
Top