Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2008 > BOOK: Professional Visual Basic 2008 ISBN: 978-0-470-19136-1
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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
Thread Tools Display Modes
  #1 (permalink)  
Old August 3rd, 2009, 06:16 PM
Registered User
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Errors msg : Keyword does not name a type and name objClass is not declare

I am using this code (page 22) of your book Visual Basic Professional 2008 (Bill Evjen,Billy Hollis,Bill Sheldon,Kent Sharkey) and is not working.

Dim objMyClass As New MyClass("Hello World")

Keep receiving error as follows:

MyClass : Keyword does not name a type

objMyClass: name objClass is not declare

Thank you.
  #2 (permalink)  
Old August 3rd, 2009, 10:28 PM
Registered User
Join Date: Apr 2009
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default "MyClass" is a placeholder in this code

The code sample you have included is just to illustrate that *any* object instance can call a ToString method. The MyClass type hasn't been defined; it is just a placeholder for some type name of a class that is either part of the .NET framework, or which you have defined somewhere else in your project.

I must admit that the type name chosen (MyClass) is a bit unfortunate, because it's a keyword and couldn't be used as the name of a class in real code. I would have chosen something different (I didn't write this particular chapter).

However, this code was never meant to work as-is - it is just intended to illustrate a minor point, and the experienced reader is expected to understand the need to insert a real class identifier (with an appropriate constructor argument) when using the technique.

Such generic placeholders are not uncommon in snippets, because it takes so long to go through a step-by-step to do a complete example of even a fairly minor point such as usage of ToString. It would have been necessary to go through the entire procedure for defining a simple class just to make a quick point.

Keep in mind that this is a book in the Professional series, so a certain level of coding expertise and experience is assumed. If you feel that you need more detail for illustration of points like this, the Beginning series might be a better choice for you.
  #3 (permalink)  
Old August 4th, 2009, 09:09 AM
Registered User
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Thank you. It's been of great help.

Best regards,

Enrique Bello

Thread Tools
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
Receiving Error Msg:Unable to cast object of type cesemj ASP.NET 2.0 Basics 2 March 4th, 2008 01:18 PM
declare My ajkumar Visual Basic 2005 Basics 0 April 18th, 2007 05:24 AM
declare a ASP variable with a TYPE crmpicco Classic ASP Basics 1 August 17th, 2005 05:52 PM
Can't get errors to display with <html:errors> michaeldill JSP Basics 0 August 2nd, 2004 01:47 PM
Errors Errors DB Errors Ljhopkins VS.NET 2002/2003 0 July 15th, 2003 12:42 PM

All times are GMT -4. The time now is 11:23 PM.

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