Question Locked

How to read default

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Lets say i have 10 fixed fields which its values needs to read from a file however my boss will give me new values in a new file which he defines from time to time

what is the best approach to do this in VB.net ?

2 replies

by Former member

If you have a custom control with a custom property, you can specify a default value for it by using the DefaultValueAttribute. For example: . 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

instead of

Note that both methods work in C#, but only the first one works in VB.NET.
http://www.codeproject.com/KB/vb/appsettings2005.aspx
http://www.google.com/search?hl=en&q=How+to+read+default+values+in+VB.net&btnG=Search

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

This discussion is closed to new replies.