Advertisement
Guest User

Untitled

a guest
Aug 29th, 2015
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. Dim descriptor As PropertyDescriptor = TypeDescriptor.GetProperties([GetType]())(PropertyName)
  2. Dim attribute As ReadOnlyAttribute = DirectCast(descriptor.Attributes(GetType(ReadOnlyAttribute)), ReadOnlyAttribute)
  3. Dim fieldToChange As FieldInfo = attribute.[GetType]().GetField("isReadOnly",
  4. System.Reflection.BindingFlags.IgnoreCase Or
  5. System.Reflection.BindingFlags.NonPublic Or
  6. System.Reflection.BindingFlags.Instance)
  7. fieldToChange.SetValue(attribute, [ReadOnly])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement