Wrox Programmer Forums
|
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 4th, 2008, 08:31 AM
Authorized User
 
Join Date: Feb 2008
Posts: 10
Thanks: 0
Thanked 1 Time in 1 Post
Default Debugger warning

Hello friends,
I am receiving a debug warning as this- "strTemp variable is used before it has been assigned a value. A null reference of exception could result at run time"

The code I used here is as follows:
strTemp = Mid(strValue,1,1)
If Len(strTemp) > 0 Then
do such a thing
End If

The use of variable strTemp second time is raising this warning.
Please show me how to avoid this warning. I have a few warnings exactly similar to this. I would be greatful to any help.
Thanks
Thillai



 
Old April 4th, 2008, 08:50 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Declare your variable with a default value

Dim strTemp as String = ""

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with debugger dhavaldesai VS.NET 2002/2003 0 August 10th, 2008 01:36 AM
Debugger error on-qsoft VS.NET 2002/2003 3 May 17th, 2007 08:56 PM
Need Help : VS Just-in-time Debugger rahi Visual Basic 2005 Basics 3 June 29th, 2006 11:43 PM
sql debugger dkspivey SQL Server 2000 1 January 12th, 2006 11:07 AM
A debugger is already attached lamdog ASP.NET 1.0 and 1.1 Basics 1 March 10th, 2005 10:39 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.