Wrox Programmer Forums
|
BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7
This is the forum to discuss the Wrox book Beginning Microsoft Visual Basic 2008 by Thearon Willis, Bryan Newsome; ISBN: 9780470191347
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7 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 July 28th, 2009, 02:12 PM
Authorized User
 
Join Date: Jul 2009
Posts: 30
Thanks: 10
Thanked 0 Times in 0 Posts
Question Identifier

Hi All

Can someone help in the book Beginning VB 2008 on page 106 I tried to use this code but got a error Identifier expected

[code]
‘Display the favorite color of the selected name
MessageBox.Show(strName & “’s favorite color is “ & strFavoriteColor,
[code/]
The problem is here _ “Select Demo”)
^Identifier expected

Last edited by headworth; July 28th, 2009 at 02:15 PM.. Reason: code
 
Old July 28th, 2009, 03:23 PM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

The code should read:

MessageBox.Show(strName & “’s favorite color is “ & strFavoriteColor, “Select Demo”)

Thearon
 
Old July 28th, 2009, 04:14 PM
Authorized User
 
Join Date: Jul 2009
Posts: 30
Thanks: 10
Thanked 0 Times in 0 Posts
Question Warning

Hi Thearon

I have changed the code but have a warning?


Warning 1 Variable 'strFavoriteColor' is used before it has been assigned a value. A null reference exception could result at runtime.
 
Old July 28th, 2009, 04:17 PM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

You can eliminate this warning in the variable declaration by setting it to an empty string. For example:

Dim strFavoriteColor As String = String.Empty

Thearon
 
Old July 28th, 2009, 04:34 PM
Authorized User
 
Join Date: Jul 2009
Posts: 30
Thanks: 10
Thanked 0 Times in 0 Posts
Thumbs up Help

Thearon Thank you for your help

Regards

Headworth





Similar Threads
Thread Thread Starter Forum Replies Last Post
picture identifier from screen chil24 Intro Programming 0 June 1st, 2008 01:36 AM
Identifier expected andriy JSP Basics 0 November 1st, 2006 11:28 PM
Unique Record Identifier peace Access VBA 1 December 6th, 2005 12:03 PM
Identifier Expected syncmaster VB.NET 2002/2003 Basics 1 September 2nd, 2004 03:34 AM





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