ebarro at afsweb.com
Sun Jul 24 11:12:20 CDT 2005
John, I would change the code to read as... Dim str As New StringBuilder For Each lstcSysVar In Me.List str.Append(" " & lstcSysVar.pValue.ToString) Next Return str.ToString() The StringBuilder class is more efficient than the old string concatenation routines in classic VB. Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Sunday, July 24, 2005 4:43 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] .net piddly warnings 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/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ---------------------------------------------------------------- The information contained in this e-mail message and any file, document, previous e-mail message and/or attachment transmitted herewith is confidential and may be legally privileged. It is intended solely for the private use of the addressee and must not be disclosed to or used by anyone other than the addressee. If you receive this transmission by error, please immediately notify the sender by reply e-mail and destroy the original transmission and its attachments without reading or saving it in any manner. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED. E-mail transmission cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of email transmission. Users and employees of the e-mail system are expressly required not to make defamatory statements and not to infringe or authorize any infringement of copyright or any other legal right by email communications. Any such communication is contrary to company policy. The company will not accept any liability in respect of such communication.
More information about the dba-VB mailing list