How to Create a User-Defined Rule



How to create a rule that will fire whenever an object is instantiated at the same time as it is declared.  


Using the example:

the line...

Dim Foo as New Collection

should be flagged

1. Get into the Rule Manager from the start button or from the DevPartner menu in VB.

2. Choose Rule...New Rule

3. Fill in the General and Description information to describe this new rule.

4. Press the Apply button.

5. Go to the Trigger tab. Press Add. Choose the scope. In the example given, the scope is line/procedure. Press Next. From the drop-down list, choose "a line of code contains". In the item box, type "Dim * as New *". Also check "Use Visual Basic 'Like' Syntax". Choose Next and then Finish.

You can also find information about creating rules in the Rule Manager Help in the "How To" section of the Contents tab.

Old KB# 11602
Comment List
Related Discussions