Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 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
Reply With Quote
  #2 (permalink)  
Old July 28th, 2009, 03:23 PM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Location: Fuquay Varina, NC, USA.
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
Reply With Quote
  #3 (permalink)  
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.
Reply With Quote
  #4 (permalink)  
Old July 28th, 2009, 04:17 PM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Location: Fuquay Varina, NC, USA.
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
Reply With Quote
  #5 (permalink)  
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
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
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



All times are GMT -4. The time now is 01:10 AM.


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