Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 4th, 2008, 08:31 AM
Authorized User
 
Join Date: Feb 2008
Location: , , .
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



Reply With Quote
  #2 (permalink)  
Old April 4th, 2008, 08:50 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
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
================================================== =========
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 01:44 PM.


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