Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DefaultValue for Tab Control ItemSize
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01057791
Message ID:
01058247
Views:
13
Hurrah!
<DefaultValue(GetType(System.Drawing.Size), "0, 0")> Public Shadows Property ItemSize() As System.Drawing.Size
            Get
                Return MyBase.ItemSize
            End Get
            Set(ByVal Value As System.Drawing.Size)
                MyBase.ItemSize = Value
            End Set
        End Property
Viv you lost me a little here... "How do you determine the valid string value for the converter - is it documented anywhere? I know that in this case it's probably reasonably obvious - just wondering about the more general case."

>Hi,
>
>>The code below is a test property I created that accesses a test field call >_testSize inside the class.
>>
>>private Size _testSize;
>>
>>[DefaultValue(typeof(System.Drawing.Size), "100, 45")]
>>public Size TestSize
>>{
>>   get { return _testSize; }
>>   set
>>   {
>>      _testSize = value;
>>   }
>>}
>>
>>If you look at the help for the DefaultValueAttribute class (attribute) and look at the available constructors you can see the following constructor signature.
>>
>>public DefaultValueAttribute(
>>   Type type,
>>   string value
>>);
>>
>>The string value must be compatible with your types TypeConverter, in this case:-
>>
>>System.Drawing.SizeConverter
>>
>>This allows you to reset complex types that the DefaultValueAttribute has no specific knowledge of.
>
>Hi,
>
>Just a question: How do you determine the valid string value for the converter - is it documented anywhere? I know that in this case it's probably reasonably obvious - just wondering about the more general case.
>
>FWIW the VB.NET equivalent of
>
>[DefaultValue(typeof(System.Drawing.Size), "100, 45")]
>is
><DefaultValue(GetType(System.Drawing.Size), "100, 45")>
>
>Regards,
>Viv
Chris Maiden
Email
Web
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform