Question

Locked

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 VB.net ?

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| 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

<DefaultValue(MyEnum.MyEnumValue)>

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.

Back to Software Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums