Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2010 > BOOK: Professional Visual Basic 2010 and .NET 4
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Visual Basic 2010 and .NET 4
This is the forum to discuss the Wrox book Professional Visual Basic 2010 and .NET 4 by Bill Sheldon, Billy Hollis, Kent Sharkey, Gaston Hillar, Rob Windsor, Jonathan Marbutt; ISBN: 9780470502242
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Visual Basic 2010 and .NET 4 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 Display Modes
  #1 (permalink)  
Old April 26th, 2012, 09:01 AM
Authorized User
Points: 44, Level: 1
Points: 44, Level: 1 Points: 44, Level: 1 Points: 44, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2012
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chap3 - MyClass example not returning any name.

I've made the changes to OfficeEmployee and Person. Stepping into the code I see that it goes to the Person class for the ToString method but the problem is the name has never been assigned to the mname string. The name assignments have been captured in the Employee class. I can see this when I look inthe Locals window. mName is empty but mNames has two entries; one for Informal and Normal respectively.

What am I missing? Any help appreciated.
Reply With Quote
  #2 (permalink)  
Old April 27th, 2012, 09:00 PM
Wrox Author
Points: 61, Level: 1
Points: 61, Level: 1 Points: 61, Level: 1 Points: 61, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2007
Location: Comox, BC, Canada.
Posts: 16
Thanks: 1
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by TJinWI View Post
I've made the changes to OfficeEmployee and Person. Stepping into the code I see that it goes to the Person class for the ToString method but the problem is the name has never been assigned to the mname string. The name assignments have been captured in the Employee class. I can see this when I look inthe Locals window. mName is empty but mNames has two entries; one for Informal and Normal respectively.

What am I missing? Any help appreciated.
Hi,

Is there a chance you missed adding the code to write the Normal name to Person?

If type=NameTypes.Normal Then
MyBase.Name = value
End If

((From page 151, just before the Shadowing section))
__________________
TTFN - Kent
Reply With Quote
  #3 (permalink)  
Old April 30th, 2012, 05:19 PM
Authorized User
Points: 44, Level: 1
Points: 44, Level: 1 Points: 44, Level: 1 Points: 44, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2012
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've got that step. Here's what I have for My Name property. I may be causing myself some grief as I was not replacing code, as suggested, but simply commenting it out. Thanks for taking a stab at it though.

Code:
   Public Overloads Property Name(ByVal type As NameTypes) As String
	 Get
	    If mNames Is Nothing Then mNames = New Generic.Dictionary(Of NameTypes, String)
	    Return mNames(type)
	 End Get
	 Set(ByVal value As String)
	    If mNames Is Nothing Then mNames = New Generic.Dictionary(Of NameTypes, String)

	    If mNames.ContainsKey(type) Then
		  mNames.Item(type) = value
	    Else
		  mNames.Add(type, value)
	    End If

	    If type = NameTypes.Normal Then
		  MyBase.Name = value
	    End If
	 End Set
   End Property
Reply With Quote
Reply


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
Passing "MyClass" Object between Pages dpkbahuguna ASP.NET 3.5 Basics 2 June 5th, 2009 10:01 AM
chap3,page:94, connection probs sandeepgreaternoida BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 April 11th, 2009 06:34 PM
Difference b/w int i; and myClass objmyClass JitenSharma ASP.NET 3.5 Professionals 2 March 31st, 2009 02:34 AM
file or assembly name "myClass", or one of its dep transtar BOOK: ASP.NET Website Programming Problem-Design-Solution 3 April 12th, 2005 10:39 AM



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


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