Wrox Programmer Forums
|
BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003
This is the forum to discuss the Wrox book Professional VB.NET 2003 by Bill Evjen, Billy Hollis, Rockford Lhotka, Tim McCarthy, Jonathan Pinnock, Rama Ramachandran, Bill Sheldon; ISBN: 9780764559921
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 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 March 7th, 2005, 02:07 AM
Authorized User
 
Join Date: Oct 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default vb.net 2nd ed ch10 Adv Obj Orien Tech

The first example demonstrates creating an app which displays the Favorites folder.This makes for an excellent examples since it extensively uses classes. However, when I typed the code word for word I recieved an error msg in the section on page 405 where I am creating an instance of the favorites object.
The line: "Dim Item As New ListViewItem"
generates a red line underneath ListViewItem
Highlighting ListViewItem yields "Type ListViewItem Not defined"
When I downloaded the code off the web I found the working code does not use the code from page 405. It refers to the same example AFTER more modifications have been added a few pages further down. Can ANYONE offer any assistance so I can pick up where I left off. I HATE abandoning a project just because I could'nt figure it out.

 
Old March 7th, 2005, 06:06 AM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

It looks as though you are using Beginning VB.Net, 2nd Edition and the code you are referring to is in Step 1 on page 405. Make sure you are adding this code to Form1 and that you followed the steps for creating the form starting on page 399.

Thearon
 
Old April 1st, 2005, 10:45 PM
Authorized User
 
Join Date: Oct 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok Thearon, I got thru that problem a while ago simply by realizing all the code was correct and therefore I should unwillingly delete my code and start from scratch. You see sir, the problem was somewhat fundamental. The line "Dim Item As New ListViewItem" simply could not be typed without that annoying red line popping up. I realized it must have something to do with the listview control and nothing more.
I picked apart the downloaded version to make the code exactly as the code I typed and , of course, your code still worked. That's when I decided to delete my solution and simply begin again. This time, however, I put the listview object on the form first, I then went to the code behind and typed the line "Dim Item As New ListViewItem". Long behold; NO RED LINE !!! It was obviously a quirky situation with VB.Net.Wait, did I say 'obviously' ? Anyhow I was able to move on. Thanx for the inspiration. On to more convoluting questions. I'd like to ask sir:Why do you elect to use three classes to address this solution.Could'nt some of thes classes have been designed as methods. It left me wondering when do I need to create a class vs when do I create a method to achieve an objective. Any suggestions ???

 
Old April 2nd, 2005, 06:08 AM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

As I was not the original author of this particular chapter I can't speak to the reasons behind the design choices. However, you always want to keep code reuse in mind and try to avoid writing the same code twice. Sometimes it makes sense to place code in a method to share it and then sometimes it makes sense to place that method in a separate class in order to have that code available to the entire project or solution.

I hope this helps.

Thearon





Similar Threads
Thread Thread Starter Forum Replies Last Post
No download for Beginning XML 2nd Ed anywhere kdalbey Forum and Wrox.com Feedback 2 December 13th, 2004 10:45 AM
Newbie question on the 2nd ed: Class inheritance elde BOOK: Professional C#, 2nd and 3rd Editions 0 December 9th, 2004 03:00 AM
Meet us a Microsoft Tech Ed May 24-27 jminatel Forum and Wrox.com Feedback 0 May 19th, 2004 11:26 AM
Prob.s with ch.16 of Profes. JSP 2nd Ed. bobbob Pro JSP 1 April 5th, 2004 06:29 AM
Cannot find code to vb.net 2nd ed..help? lizardnotebk BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 0 September 2nd, 2003 07:17 PM





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