Wrox Programmer Forums
|
BOOK: Professional Visual Basic 2008 ISBN: 978-0-470-19136-1
This is the forum to discuss the Wrox book Professional Visual Basic 2008 by Bill Evjen, Billy Hollis, Bill Sheldon, Kent Sharkey; ISBN: 9780470191361
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Visual Basic 2008 ISBN: 978-0-470-19136-1 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 August 21st, 2008, 01:25 PM
Registered User
 
Join Date: Aug 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default The DBNull Class and IsDBNull Function

Pages 25,26
The code does not do what the text indicates that it does.
"The first conditional is evaluated to True."
--- The first conditional is NOT evaluated to TRUE


        Dim sysNull As System.DBNull = System.DBNull.Value
        Dim strMyString As String = Nothing

        If strMyString Is sysNull Then
            Console.WriteLine("1st condition is true") 'line_added
            strMyString = "Initialize my String"
        End If
        If Not IsDBNull(strMyString) Then
            Console.WriteLine("2nd condition is true") 'line_added
            Console.WriteLine(strMyString)
        End If
        Console.WriteLine("Done with dbNull test ") 'line_added


 
Old September 27th, 2008, 09:13 AM
Registered User
 
Join Date: Sep 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You are correct. But this might have worked in a previous version of VB.NET, and the author of that code likely assumed it would still work. Either that, or the author THOUGHT that the code was correct but didn't bother to test it. That's about all I can think of right now.





Similar Threads
Thread Thread Starter Forum Replies Last Post
return collection by function in class jimusa Visual Basic 2005 Basics 1 July 30th, 2008 03:18 PM
function return collection in class by VB jimusa Visual Studio 2005 1 July 30th, 2008 03:12 PM
Running a class function c# rahilahmed C# 2 September 13th, 2007 11:19 AM
How do I make a function return a class? vertigo VB How-To 3 November 3rd, 2004 06:08 AM
Calling base class assignment function gstroud Visual C++ 8 September 23rd, 2004 02:33 AM





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