From: Mr. X. on
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 :)



From: Mr. X. on
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 :)

"Mr. X." <nospam(a)nospam_please.com> wrote in message
news:O6wksIeELHA.4824(a)TK2MSFTNGP05.phx.gbl...
> 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 :)
>
>
>
From: Mr. X. on
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).

"Mr. X." <nospam(a)nospam_please.com> wrote in message
news:O1PQ7eeELHA.1868(a)TK2MSFTNGP05.phx.gbl...
> 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 :)
>
> "Mr. X." <nospam(a)nospam_please.com> wrote in message
> news:O6wksIeELHA.4824(a)TK2MSFTNGP05.phx.gbl...
>> 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 :)
>>
>>
>>
From: Mr. X. on
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 :)
From: Armin Zingler on
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")

--
Armin