Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2010 > BOOK: Professional Visual Basic 2010 and .NET 4
|
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 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 April 26th, 2012, 09:01 AM
Authorized User
 
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.
 
Old April 27th, 2012, 09:00 PM
Wrox Author
 
Join Date: Jun 2007
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
 
Old April 30th, 2012, 05:19 PM
Authorized User
 
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





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





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