|
|
 |
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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

August 3rd, 2009, 07:16 PM
|
|
Registered User
|
|
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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")
Console.WriteLine(objMyClass.ToString)
Keep receiving error as follows:
MyClass : Keyword does not name a type
objMyClass: name objClass is not declare
Thank you.
|

August 3rd, 2009, 11:28 PM
|
|
Registered User
|
|
Join Date: Apr 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
"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.
|

August 4th, 2009, 10:09 AM
|
|
Registered User
|
|
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
"MyClass" IS A PLACEHOLDER IN THIS CODE
Thank you. It's been of great help.
Best regards,
Enrique Bello
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |