Our forums are currently in maintenance mode and the ability to post is disabled. We will be back up and running as soon as possible. Thanks for your patience!



How to read default

By kennethnyc ·
Lets say i have 10 fixed fields which its values needs to read from a file however my boss will give me <b>new values in a new file which he defines</b> from time to time

what is the best approach to do this in ?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Some examples here...

If you have a custom control with a custom property, you can specify a default value for it by using the DefaultValueAttribute. For example: <DefaultValue("")>. This will tell Visual Studio.NET not to serialize the value to the container's code when it is equal to the default value (an empty string in this case). However, if the type of your property is an Enum, you can't just specify the default enum value. You must use an overload to specify the type of the enum and the default value as a string. So use

<DefaultValue(GetType(MyEnum), "MyEnumValue")>

instead of


Note that both methods work in C#, but only the first one works in VB.NET.

Please post back if you have any more problems or questions.

Related Discussions

Related Forums