Visible Progress Home We make progress visible.
Search Site:
Support > VB Law  
Support
VS Law 2005
VS Law .NET
VB Law
Frequently Asked Q's
6.2 Release Notes
6.1 Release Notes
6.0 Release Notes

Our Customers...
What Customers Say...

VS Law 2005 - VB.NET 2005 coding standards enforcement.
Try our products for free today.
VS Law .NET - VB.NET 2002/2003 coding standards enforcement.
Try our products for free today. VB Law - VB6 coding standards enforcement.
 
 

VB Law Frequently Asked Questions

Note: Whether you are evaluating VB Law or an existing customer, we aim to offer the best possible support so please don't hesitate to ask if you have a question or need some help.

Q: If I buy VB Law today, will I be entitled to a free upgrade to VS Law for .NET?
A: As VS Law for .NET is a major version upgrade, you will not generally be entitled to a free upgrade. However, you will be entitled to an upgrade price which will typically be 50% or less of the standard retail price. Contact us for details.

Q: Does VB Law support reviews of VBA within Office documents?
A: No. VB Law was designed purely for Visual Basic 6. However, you can paste VBA code from Office documents into a VB6 project to perform a review using VB Law.

Q: What are pending violations and how do I use them?
A: Pending violations are coding conventions whose violations will be raised automatically unless they are cancelled by the rule condition. A good example of a coding convention that would use a pending violation is requiring the 'Option Explicit' statement to appear in all source files to ensure that variables are properly declared before use.

The 'Option Explicit' statement must appear in the declarations section of a source file. However, it does not have to be the first line and could appear anywhere, therefore defining the rule as a pending violation and attaching it to the 'Declaration' parser event with the end event set to 'end Declarations' means that the rule condition will be executed for each line in the declarations section of a file and, if the rule condition does not find an 'Option Explicit' statement and cancel the pending violation, the violation will be raised automatically when the 'end Declarations' event is fired.

Q: What are workfields and how do I use them?
A: Workfields can be regarded as parser object variables used to retain information between rule invocations. All parser objects exposed by VB Law support workfields. However, you should be aware that workfields attached to an individual parser object are retained only for the lifetime of that object.

An example of using workfields might be to count source comment lines for an entire project (you don't actually need to do this because VB Law already does it) and raise a violation if there are less than 100. To achieve this you could create a coding convention attached to the 'begin Project', 'Source Line' and 'end Project' parser events with the following rule condition:

								
	Const sWF_OBJECT As String = "Project"
	Const sWF_NAME As String = "CommentLineCount"
	
	Dim sEvent As String
	Dim lCount As Long
	
	sEvent = VBLaw.ParserEvent()
	Select Case sEvent
	    Case "begin Project"
	         'initialise the comment line count workfield
	         VBLaw.SetObjectWorkField(sWF_OBJECT, sWF_NAME, 0)
	
	    Case "Source Line"
	         If VBLaw.GetObjectProperty("Source", "IsComment") Then
	             'get the workfield value, increment it and save it back
	             lCount = VBLaw.GetObjectWorkfield(sWF_OBJECT, sWF_NAME)
	             lCount = lCount + 1
	             VBLaw.SetObjectWorkField(sWF_OBJECT, sWF_NAME, lCount)
	         End If
	
	    Case "end Project"
	         'read the workfield value and raise a violation if less than 100
	         lCount = VBLaw.GetObjectWorkfield(sWF_OBJECT, sWF_NAME)
	         If lCount < 100 Then
	             VBLaw.RaiseViolation()
	         End If
	End Select

Q: You use regular expressions for naming conventions, how do I find out more about them?
A: We provide a basic overview and reference for regular expressions in Appendix 2 of the VB Law Administrator help file. For further explanations, there are many web sites offering information about the use of regular expressions (just perform a search for 'Regular Expressions' in any search engine).

Q: How can I write and access common functions that are used by multiple rule conditions?
A: Unfortunately you can't, VB Law requires that all the code for the condition be written in a single procedure, however, it is possible to package common functions in an external component and call them (see the next question for more details about external components).

Q: Can I call functions in external components?
A: Yes, Sax Basic supports CreateObject, therefore it is entirely possible to call functions in external components, however you should be aware of the following limitations:

  • VB Law does not support adding references to the Sax engine therefore all calls will be late bound.
  • Object references cannot be cached between rule condition invocations therefore the object will need to be created and destroyed within a single execution of a rule condition and depending on the parser event(s) the rules is attached to may have a serious impact on performance.
  • The external component will need to be distributed with the rulebase and registered.

Q: Can I output data to a text file rather than raise a violation?
A: Yes, Sax Basic supports the same file system functions as Visual Basic, so instead of calling VBLaw.RaiseViolation, just open a file and write an appropriate message to it.

Q: When will it be possible to import/export rules?
A: This feature has been requested a number of times and will be implemented in a later version of VB Law.

Q: Do you intend to implement support forums so that VB Law users can share their experiences and knowledge of the product?
A: Yes, although no date has been set yet.

Q: Why do I need to browse to find the results database when I open a project?
A: If you choose to create results in a location other than the project folder when you perform a review then VB Law Workstation will not know where to find them.

Q: How can I view the report generated after a review?
A: The 'View Report' button on the Review Summary dialog will display the report via the application registered to view files of type '.html' (this is usually the default web browser).

Q: Why do I get "Error 429 - ActiveX component can't create object in function OpenDatabase module C_ResultsDB.cls" when attempting to perform a review?
A: This error can occur if the file DAO360.dll is not correctly registered on your system (a previous uninstall of another application may have accidentally caused this). To correct the problem simply re-register DAO360.dll using 'regsvr32.exe'.
e.g.
regsvr32.exe "C:\Program Files\Common Files\Microsoft Shared\DAO\DAO360.DLL"

Q: Why does 'Go To Source' sometimes take me to somewhere other than the code line with the violation?
A: The most common cause of this problem is if a source file has been amended significantly since the review was performed although occasionally this is due to a bug in the grid control. Generally, the grid control problem is resolved by selecting a different violation and then selecting the original violation again.

Note: Whether you are evaluating VB Law or an existing customer, we aim to offer the best possible support so please don't hesitate to ask if you have a question or need some help.