Updated: 14/12/2005; 9:54:43.
Hannes 'Shorty' Decorte's Blog | SharePoint, .Net 2.0, ...
Bringing SharePoint, Office and .Net information


donderdag 24 november 2005


See it here http://www.regexlib.com


9:49:03 AM    comment []

There is an interesting new overloaded method in the Form class in .Net 2.0 :

ValidateChildren() and ValidateChildren(ValidationConstraints validationConstraints)

From the MSDN web site:

.NET Framework Class Library  

ContainerControl.ValidateChildren Method ()  

Note: This method is new in the .NET Framework version 2.0.

Causes all of the child controls within a control that support validation to validate their data.

Return Value

true if all of the children validated successfully; otherwise, false.

Remarks

ValidateChildren will descend a control's hierarchy and examine each control to see if it supports validation. If the control can be selected by the user and its CausesValidation property is true, ValidateChildren will cause the Validating event to occur. If any of the controls cancel the Validating event, this method will return false; otherwise, it will return true.

If a control is bound to a data source, and the Validating event occurs, it will cause the control to push its current data back to the data source.

Calling ValidateChildren is equivalent to calling ValidateChildren with a ValidationConstraints of None.

ValidationConstraints Members

  Member name Description
  Enabled Validates child controls whose Enabled property is set to true
  ImmediateChildren Validates child controls that are directly hosted within the container. Does not validate any of the children of these children. For example, if you have a Form that contains a custom UserControl, and the UserControl contains a Button, using ImmediateChildren will cause the Validating event of the UserControl to occur, but not the Validating event of the Button.  
  None Validates all child controls, and all children of these child controls, regardless of their property settings.  
  Selectable Validates child controls that can be selected. 
  TabStop Validates child controls that have a TabStop value set, which means that the user can navigate to the control using the TAB key.  
  Visible Validates child controls whose Visible property is set to true

 


9:03:20 AM    comment []

To enumerate all the methods available in a designtime component(e.g. UITypeEditor), start from the IServiceProvider passed to the component.

Get the available types.

ITypeDiscoveryService
service = (ITypeDiscoveryService)ServiceProvider.GetService(typeof(ITypeDiscoveryService));
ICollection icolletion = service.GetTypes(typeof(object), true);

For each type in the collection get the public methods

type.GetMethods(BindingFlags.FlattenHierarchy | (BindingFlags.Public | (BindingFlags.Static | BindingFlags.Instance))

If you want to eliminate abstract methods, methods with void as return type, and property get and setters, apply the following check.

!methodInfo.ReturnType.Equals(typeof(void)) && (((methodInfo.GetBaseDefinition().DeclaringType != typeof(object)) & !methodInfo.IsSpecialName) && !methodInfo.IsAbstract)

Based on .Net 2.0

 


7:54:20 AM    comment []

© Copyright 2005 Hannes 'Shorty' Decorte.
 
November 2005
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      
Sep   Dec


RSS Feed


Other .Net Bloggers

Bart De Smet
Jan Tielens
Patrick Verbruggen
Patrick Tisseghem
Tom van de Kerkhof's Bloggings
Tom's Corner
Yves Hanoulle

Aggregated Feeds

Belgian .NET Bloggers