[dba-VB] .net piddly warnings

John W. Colby jwcolby at colbyconsulting.com
Sun Jul 24 06:42:53 CDT 2005


I am getting a lot of warnings like 

Variable Umptiumpt used before it is assigned a value.  The following code
causes such a warning:

        Dim str As String
        For Each lstcSysVar In Me.List
            str = str & " " & lstcSysVar.pValue.ToString
        Next
        Return str

This is quite common methodology and would require the quite unnecessary 
	
	str = ""

After the dim statement to avoid the warning.

Is there any way to acknowledge the warning and cause it to go away,
preferably for specific instances (lines) of code?  It seems that unless you
just always do the variable initialization you are going to end up with
hundreds of useless warnings masking real warnings that you wish to be made
aware of.

John W. Colby
www.ColbyConsulting.com 

Contribute your unused CPU cycles to a good cause:
http://folding.stanford.edu/






More information about the dba-VB mailing list