Head First C# by Andrew Stellman, Jennifer Greene This errata page lists errors fixed in the April 2008 reprinting. If you have technical questions or error reports, you can send them to booktech@oreilly.com. Please specify the printing date of your copy. This page was updated March 18, 2008. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification Confirmed errors: (9) Add an annotation inside the screenshot, in the space next to the form: You can also bring up these windows by selecting Solution Explorer, Properties or Error List from the View menu. (15) body text In the third line of the first paragraph, change "users double-click on it" to "users run the program and click on the logo" Change the second paragraph to this: When you're editing a form in the IDE, double-clicking on any of the toolbox controls causes the IDE to automatically add code to your project. Make sure you've got the form showing in the IDE, and then double-click on the PictureBox control. The IDE will add code to your project that gets run any time a user clicks on the PictureBox. You should see some code pop up that looks like this: {50} step 1, line of code Change this: public partial class Form1 : Form to this: partial class Form1 (71) Sharpen Your Pencil Add this annotation in the space under loop #5 pointing up at it: Hint: q starts out equal to zero. Think about when the iterator "q = q * 2" is executed. (72) Sharpen Your Pencil solution Add this annotation under loop #5 pointing up at it: After iteration #1, q equals 2. Then it equals 0, then 4, then 0, 8, 0, 16, 0, and the loop stops when it hits 32. Take the time to really figure this one out. It might help to paste the code into the IDE and add messageboxes that pop up the values of p and q. {76} step 3, first line: Change "adding this line before" to "adding this line after" {77} top right annotation This annotation is on the wrong page -- it should be on page 75, with an arrow that points from the annotation on page 77 to the existing one at top. (83) - pool puzzle solution Add text in the lower right-hand corner of the page: Did you get a different solution? Type it into the IDE and see if it works! There's more than one correct solution to this pool puzzle. Then add an annotation underneath it, pointing at it: If you want a real challenge, see if you can figure out what it is! Here's a hint: there's another solution that keeps the word fragments in order. (89) code in step 2: Add this annotation pointing to the "finalString = ..." line: "This line of code adds the contents of thingToSay and a linebreak onto the end of it the finalString variable." (89) step 3, first line: change "run this code:" to "run this code that calls BlahBlahBlah() and assigns its return value to an integer called len:" (89) third annotation ("The BlahBlahBlah() method...") Add a new annotation to the right of this one: This is called a property -- every string has a property called Length. When it calculates the length of a string, \n counts as one character. (97) Thought bubble at top of page; The text "So does that means" should be "So does that mean" (98) body text, second to last line "horizotal" is misspelled -- should be "horizontal" (125) First para. first list item; In the description of the double type, "with 15-16 significant digit." should be "with 15-16 significant digits". (133) third annotation change this: The range for these fields should be 1-999,999. to this: For the two NumericUpDown controls, set the Minimum property to 1 and Maximum to 999999. {143 and p144} (both the exercise and the solution) #1, fourth line of code change "Fido;" to "fido;" (make it lowercase) {145} fifth annotation Change this annotation to: When Rin Tin Tin moved to Lucky's object, the old Rin Tin Tin object disappeared. (148) body text under the second heading in the middle of the page ("Here's an example of code...") Add these three sentences to the beginning of the body text: When you use an array, first you need to declare a reference variable that points to the array. Then you need to create the array object using the new statement, specifying how big you want the array to be. Then you can set the elements in the array. (the phrases "declare a reference variable", "create the array object" and "set the elements" should be in boldface.) (150) step 2 Change: Add a GetMenuItem() method to generate a random sandwich to the class To: Add a GetMenuItem() method to the class that generates a random sandwich (152) step 2, first line Change: Now letÕs this SpeakTo() To: Now letÕs add this SpeakTo() (153) last answer, fourth line change: A virtual machine is a way for to to: A virtual machine is a way for it to (154) Question 2; "... every time a change a value ..." should be: "... every time I change a value ..." {154} - bullet points, first bullet, 3rd line change: (up to 128) to: (up to 256) (166) text in top right of the page In the text in the top right corner ("You'll need to add..."), add this sentence to the end: And you'll need to add "using System.Drawing;" to Greyhound, because it uses Point. {166} Greyhound class diagram box Change "StartingLocation" to "StartingPosition" (167) lines 6 and 7 of the code: in this code: public RadioButton MyRadioButton; // My RadioButton public Label MyLabel; // My Label change the boldface so MyRadioButton and MyLabel are in bold instead. (167) 2nd comment in UpdateLabels method; Comments read // Set my label to my bet's description, and the label on my // my radio button to show my cash ("Joe has 43 bucks") but should read // Set my label to my bet's description, and the label on // my radio button to show my cash ("Joe has 43 bucks") (167) bottom of page move the lower right annotation ("This is a common...") so that it points to the GetDescription() method instead of the PayOut() method (170) Middle paragraph at bottom of page; "Each lablel has AutoSize set to False..." should read "Each label has AutoSize set to False..." (171) Add an annotation to the bottom of the page: "Make sure all the Greyhound objects share one Random object! If each dog creates its own new instance of Random, you might see a bug where all of the dogs generate the same sequence of random numbers." {184} drawing under step #1, top arrow Change this: CalculateCostOfDecorations(false); to this: CalculateCostOfDecorations(true); {184} bottom of page, label under the bottom arrow Change $350 to $575 {185} third-to-last line of code change: public void GetNumberOfPeople() to: public int GetNumberOfPeople() (192) bottom left annotation add this sentence to that annotation: PascalCase means capitalizing the first letter in every word in the variable name. camelCase is similar to PascalCase, except that the first letter is lower-case. That makes the upper-case letters look like "humps" of a camel. (196) step 2, second paragraph; The text "Wait, that make sense." should read "Wait, that makes sense." {197} first paragraph, fourth line Change "very first thing that gets instantiated" to "very first thing that gets executed" {204} code in the DinnerParty method change "this.NumberOfPeople = numberOfPeople;" to "NumberOfPeople = numberOfPeople;" also, change the annotation pointing to it: change: "Make sure you put it in front of NumberOfPeople so that it calls the set accessor." to "You'll need it to tell the difference between the parameter and private field named numberOfPeople." and change the annotation pointing to that: change: "And youÕll need to put it" to: "So you'll need to put this." (207) step 2 change this: "to show how much cash Joe and Bob had back in Chapter 3." to this: "to choose which guy placed the bet in the Betting Parlor lab." {208} step 1, first bullet change "Add a CakeSize integer property." to "Add a public int field called CakeSize." (228) top right block of code Add an annotation pointing to the line "A a2 = new C();" that says: "Hint: Think really hard about what this line really means." (230) Add some body text in the empty space on the left of the Mixed Messages solution: You can always substitute a reference to a subclass in place of a base class. In other words, you can always use something more specific in place of something more general--so if you've got a line of code that asks for a Canine, you can send it a reference to a Dog. So this line of code: A a2 = new C(); means that you're instantiating a new C object, and then creating an A reference called a2 and pointing it at that object. Names like A, a2 and C make for a good puzzle, but they're a little hard to understand. Here are a few lines that follow the same pattern, but have names that you can understand: Sandwich mySandwich = new BLT(); Cheese ingredient= new AgedVermontCheddar(); Songbird tweety = new NorthernMockingbird(); {231} first answer, second paragraph, last line Change "project type" to "output type" [235] step 3, last bullet: Change the text of the last bullet (which starts "You'll need to override...") to this: Uh-oh -- we can't override the CalculateCost() method here if we want to keep the form code the same, because our form needs to pass it a bool called healthyOption. So instead, we'll overload it -- which just means adding a new CalculateCost() method to the class that takes different parameters. So you'll use exactly the same declaration for the method that you used at the beginning of the chapter. But you can still take advantage of inheritance by calling base.CalculateCost() to access the CalculateCost() method in the Party class. Add an annotation pointing to that bullet that says, "You'll learn all about overloading in chapter 8 -- this is just a sneak preview to give you a leg up on it later." {236} bottom of code change this: TotalCost += 100; to this: TotalCost += 100M; [238] bottom annotation Change this annotation to: DinnerParty needs a different CalculateCost() that takes a parameter, so instead of overriding it we overloaded it. It calls the CalculateCost() method in Party using the base keyword, and then adds the cost of the beverages and adds in the healthy option discount. Add another annotation underneath it, pointing up at it: You'll learn all about how overloading works in Chapter 8. [238] Underneath the exercise solution, add this text: Uh-oh -- there's still a potential bug still in the program! Now the DinnerParty class has two CalculateCost() methods, one that it inherits from Party and this new one that we added. We haven't fully encapsulated the class -- someone could easily misuse this code by calling the wrong Calculatecost() method. So if you do this: DinnerParty dinner = new DinnerParty(5, true, true); decimal cost1 = dinner.CalculateCost(true); decimal cost2 = dinner.CalculateCost(); cost1 will be set to 261.25, while cost2 will be set to 250. This isn't an academic question -- it's a real problem. Sometimes there's code in the base class that you don't want to call directly. Even worse, we never intended the Party class to be instantiated... but there's nothing stopping someone from doing it. Do we even know what will happen if someone creates an instance of Party? We can be pretty sure it'll do something we didn't plan for. Luckily, C# gives us a really good solution to these problems, which you'll learn about in the next chapter! {241} step 2 body text In the third-to-last line, change "and its shiftNumber to zero" to "and its shiftsWorked to zero". In the second-to-last line, change "it decreases shiftNumber by one" to "it increases shiftsWorked by one". {245} diagram In the "Bee" box on the bottom, change the word "private" to "virtual". Then add an annotation to the right of the box pointing to that line: "All bees consume honey, so we'll add a GetHoneyConsumption() method to the base class so the queen and workers can inherit it. But bees and workers consume honey differently. We'll make it a virtual method, so one of the subclasses can override it." {246} step 1, 4th bullet, last sentence Change this: "This includes both workers and queens." to this: "This doesn't include queens, though (see below)." {254-256} Pages 254-256 have been substantially revised since the first printing to enhance clarity and quality of learning. You can download a PDF containing the revised pages at: http:// www.headfirstlabs.com/books/hfcsharp/hfcsharp_ch07_excerpt.pdf (261) step 1: Add an annotation underneath step 1 pointing up at the code: "Let's assume that StingPatrol implements the IStingPatrol interface and NectarCollector implements the INectarCollector interface." (262) Add a NDQ question and answer in the space in the upper right-hand corner of the page: Q: Wait a minute. When I put a property in an interface, it looks just like an automatic property. Does that mean I can only use automatic properties when I implement an interface? A: No, not at all. Yes, a property inside an interface looks very similar to an automatic property -- like Job and Left in IWorker interface on the next page. But they're definitely not automatic properties. You could use implement Job like this: public Job { get; private set; } You need that private set, because automatic properties require you to have both a set and a get (even if they're private). But you could also implement it like this: public job { get { return "Accountant"; } } and the compiler will be perfectly happy with that, too. You can also add a set accessor -- the interface requires a get, but it doesn't say you can't have a set, too. (If you use an automatic property to implement it, you can decide for yourself whether you want the set to be private or public.) {264} code Change this: {get {return ShiftsToWork - ShiftsLeft;}} to this: {get {return shiftsToWork - shiftsWorked;}} And in this line: public bool DoThisJob(string Job, int ShiftsToWork){...} change "ShiftsToWork" to "shiftsToWork" (S should be lowercase) {264} end of code add this after "public bool DoThisJob(string Job, int shiftsToWork){...}" -- make sure it's indented the same, and move the annotation underneath down public void WorkOneShift() {...} (265) top annotation ("All these bees...") Add an annotation above the top annotation pointing down at it: "You can create an array of IWorker referenes, but you can't instantiate an interface. But what you can do is point those references at new instances of classes that implement IWorker. Now you can have an array that holds many different kinds of objects!" {265} last line of code above the Sharpen Change this: thisCollector.EmptyNectarBucket(); to this: thisCollector.GatherNectar(); {265} Sharpen Your Pencil, second-to-last line of code change this: Bees[6] = Bees[2]; to this: Bees[6] = Bees[0]; {271} step 3, last line change "Honk()" to "ScareLittleChildren()" {271} the class diagram in the corner has errors In the top of the "Clown" box, change the bold text "Clown" to "FunnyFunny" In the top of the "ScaryClown" box, change the bold text "ScaryClown" to "ScaryScary" (272) add an annotation pointing to the the last line of code at the bottom of the page (someOtherScaryClown.Honk();): "You can also use the someOtherscaryClown reference to call ScareLittleChildren() -- but you can't get to it from the someFunnyClown reference." (272) body text, last sentence at the top of the page change "witht he" to "with the" (273) first bullet change "any member of other class" to "any instance of any other class" Add an annotation underneath the second bullet (put "private" in courier new bold): If you leave off the access modifier when you declare a class member, it defaults to private. (273) fourth bullet, fifth line put the word "internal" in Courier New Add an annotation underneath the fourth bullet (with "internal" in courier new bold): If you leave off the access modifier when you declare a class or an interface, then by default it's set to internal. And that's just fine for a most classes -- it means that any other class in the assembly can read it. If you're not using multiple assemblies, internal will work just as well as public for classes and interfaces. Give it a shot -- go to an old project, change come of the classes to internal and see what happens. (273) First paragraph, last sentence; The text is: "..., but we'll start witht he ones you know:" This should be: "..., but we'll start with the ones you know:" {279} ninth line of code change this: return MilesToPlanet / RocketSpeedMPH; to this: return MilesToPlanet / (int) RocketSpeedMPH; (280) Add a new Brain Power at the bottom of the page: Flip back to the solution to KathleenÕs party planning program in the previous chapter on pages 236Š238--take another look at the encapsulation problems that we left in the code. Can you figure out how you'd use an abstract class to solve them? {286} class diagram, MoviePlayer box change "Eat()" to "ShowAMovie()" (287) Note by puzzle pool; The note by the pool states: "Note: each snippet from the pool can be used more once!" This should be "... more than once!" (289) body text, fourth line change "use it in a method" to "using it in a method" {290} second-to-last line on the page change "DoorLocation field contains a reference to" to "DoorLocation property contains a reference to" (292) third annotation ("You started...") Change: "and add these two classes that implement it." to: "and added these two classes that implement it." (293) final star bullet point; In the text "...that the door coonects to." the word "coonects" should be "connects". (295) bottom of code in this -- " You see " -- the second quote is facing the wrong way (301) third annotation, fourth line change "locaiton," to "location," (304) Move the bottom annotation down and fit a new annotation just above it, pointing at the DoEvents() line? It should say: "Remember DoEvents() from FlashyThing in Chapter 2? Without it, the textbox doesn't refresh itself and the program looks frozen." (305) clue for 13 across in "The is keyword" put "is" in courier bold (305) clue for 6 across change: "When you use a pass subclass to a method" to: "When you pass a subclass to a method" (312) body text at top change this: ItÕs inside the DogCompetition class, to this: This enum is inside the DogCompetition class (a lot of the time, your enum won't be inside any class!) (312) body text, fourth line change: "track of a the scores" to: "track of the scores" (312) annotation pointing to (int) cast; The second sentence states: "So since TrickScroe.Speak has an index of to 20, (int) TrickScore.Speak turns it into the int value 20." Two typos there, the unnecessary "to", and the "TrickScroe" misspelling. {312} Code Change "Speak = 20," to "Speak = 30," The last four lines of code in the block of code (starting with "// code later in the class") should be changed to these five lines: // code later in the class int value = (int)TrickScore.Fetch * 3; MessageBox.Show(value.ToString()); TrickScore score = (TrickScore)value; MessageBox.Show(score.ToString()); Change the fourth annotation on the right to: Since Fetch has an index of 10, this statement sets value to 30. In the fifth annotation on the right, make the arrow point downwards towards "TrickScore score = (TrickScore)value;" and change it to: You can cast an int back to a TrickScore. Since value is equal to 30, score gets set to TrickScore.Speak. So when you call score.ToString(), it returns "Speak" In the whitespace in the upper right-hand corner of the page, add the following sentence: You can cast an int to an enum, and you can cast an enum back to an int. (321) bold sidebar on right hand side; In the first line, "foreach is special kind..." should be "foreach is a special kind" In the third line, "statment" should be "statement" {322} seventh bullet change "count property" to "Count property" (327) Top; In the text "Here's a duck class that keeps track of your extensive duck colleciton", "colleciton" should be "collection". {327} block of code, first line change "Ducks" to "ducks" Also, add an annotation in the whitespace underneath the bottom middle and right ducks, pointing to "public enum KindOfDuck": The KindOfDuck enum isn't in a class, which is very common for an enum. Most enums you'll run across won't be inside classes. (331) sixth annotation Change this: "We used the value of the Type that comes from the index value in the enum Duck.Type." To this: "We compared the ducks' Kind properties, so the ducks are sorted based on the index value of the KindOfDuck enum." (331) second-to-last annotation change: One type is Ņgreater thanÓ another, just so we have an ordering we can use. to: We used < and > to compare enum index values, which let us put the ducks in order. {332} Change the code at the bottom from: ducks.Sort(); to: ducks.Sort(dc); (it occurs two times) {332} top left annotation change "CompareTo()" to "Compare()" (333) step 2 body text, last sentence in "... make sure that any king comes after than any jack, which comes after than any four, which comes after than any ace." change the three occurrences of "after than" to "after" {334} top left annotation, last line change this: "compares their suits, then their values." to this: "compares their values, then their suits" {334} second annotation change: "If x has a bigger suit, return 1. If xÕs suit" to: "If x has a bigger value, return 1. If x's value" {334} third annotation in: "These statements only get executed if x and y have the same suit" change "suit" to "value" {338} middle annotation on the left change: "Each of the reset1 and reset2 buttons first calls the RedrawDeck() method and then the ResetDeck() method" to this: "Each of the reset1 and reset2 buttons first calls the ResetDeck() method and then the RedrawDeck() method" (340) fourth and fifth annotations swap the fourth and fifth annotations, so the one about Shuffle() is pointing to the Shuffle() method and the one about GetCardNames() is pointing to the GetCardNames() method (343) Add an annotation in the space to the right of step 3: You've seen overloading already. Flip back to the solution to Kathleen's party planning program in Chapter 6 on pages 236-238--you added an overloaded CalculateCost() method to the DinnerParty class. (346) middle annotation on the right, starting with "Using SelectionStart and ScrollToCaret() like this scrolls the text box", change "text box" to "textbox" and reverse the arrow underneath that annotation so that it points up, not down (348) second to last line of code ("public Card Peek(int cardNumber) { return cards.Peek(cardNumber); }") make sure that the first occurrence Peek is in boldface, not cardNumber {351} fourth and fifth lines of code change the three instances of "Books" to "books" add a big annotation to the bottom of the page: Here's a hint for writing the GetWinnerName() method: You'll need to create a new Dictionary called winners at the top of the method. The winners dictionary will let you use each player's name to look up the number of books he made during the game. First you'll use a foreach loop to go through the books that the players made and build the dictionary. Then you'll use another foreach loop to find the highest number of books associated with any player. But there might be a tie -- more than one player might have the most books! So you'll need one more foreach loop to look for all the players in winners that have the number of books that you found in the second loop and build a string that says who won. (each occurrence of "winners" is in courier bold inside the annotation) {370} Change these lines: new Point(boundaries.Left + 10, boundaries.Top + 70), boundaries); to this: new Point(boundaries.Left + 10, boundaries.Top + 70)); {371} Change this: Enemies.Add(new Bat(this, GetRandomLocation(random), boundaries)); to this: Enemies.Add(new Bat(this, GetRandomLocation(random))); {374} middle of page Change this line: public Player(Game game, Point location, Rectangle boundaries); to this: public Player(Game game, Point location); and move the annotation over so the arrows point to "game" and "location" (374) upper-righthand corner Add this annotation to the empty space in the upper righthand corner of the page: "The Player and Enemy objects need to stay inside the dungeon, which means they need to know the boundaries of the playing area. Use the Contains() method of the boundaries Rectangle to make sure they don't move out of bounds." {376} Change this line of code: public Enemy(Game game, Point location, Rectangle boundaries, int hitPoints) to this: public Enemy(Game game, Point location, int hitPoints) {377} Change this: public Bat(Game game, Point location, Rectangle boundaries) : base(game, location, boundaries, 6) to this: public Bat(Game game, Point location) : base(game, location, 6) {393} second line of code change this: "d:\secret_plan.txt" to this: "c:\secret_plan.txt" {395} Pool Puzzle Add "ReadLine" and "WriteLine" to the pool {402 and 404} first line of code is missing an exclamation point change this: if (Directory.Exists(@Óc:\SYPÓ)) { to this: if (!Directory.Exists(@Óc:\SYPÓ)) { (405) second paragraph, first line change "in the IDE the official C#" to "in the IDE to show you the official C#" (405) second annotation, last line change "itÕs done" to "you're done" {409} step 4 In the body text, change "Clicking the Save button" to "Clicking the Open button" In the fourth bullet, change "If the user tries to open the current excuse" to "If the user tries to open a saved excuse" {415} second line of code in "Cards = new List();" -- change "Cards" to "cards" {415} - fourth-to-last line of code in "Cards.Add(new Card(suit, value));" -- change "Cards" to "cards" (418) Brain Barbell, text at top Change "part of the state?" to "part of the Car object's state?" {427} code for steps 3 and 4 Add a closing bracket } at the end of the code for step 3 -- and make sure that it's unindented by two spaces, so that it lines up with "using" in step 2. Then remove the closing bracket at the end of step 4, and unindent the rest of the lines of code in step 4 by two spaces. {428} code for steps 2 and 3 Remove the closing bracket } at the end of the code for step 2. Indent the four lines of code in step 3 by three spaces. Add a new closing bracket } at the bottom of the code under step 3, just after the Console.Write... line. (you may need to move all of step 3 up a little) {436} 11th line of code remove this line of code: openFileDialog1.FileName = description.Text + ".excuse"; and change the top right annotation change: "these four lines" to: "these three lines" and change: "two in the open button's" to "one in the open button's" {444} first line of code is missing [] Change this: int anArray = {3, 4, 1, 11}; to this: int anArray[] = {3, 4, 1, 11}; {447} second line of code change this: Directory.GetFiles(Folder,"*.excuse"); to this: Directory.GetFiles(selectedFolder,"*.excuse"); {463} Pool Puzzle Add the word "return" to the pool (473) second answer, second-to-last line change "bepretty" to "be pretty" {491} third answer, fourth-to-last line Change "DragEventHandler," to "DragEventArgs," {493} step 5, first line of code change this: void ball_BallInPlay(BallEventArgs e) { to this: void ball_BallInPlay(object sender, EventArgs e) { (499) Add a Q and A to the upper right-hand corner of page 499. Q: When I added a new event handler to the Pitcher object, why did the IDE make it throw an exception? A: It added code to throw a NotImplementedException to remind you that you still need to implement code there. That's a really useful exception, because you can use it as a placeholder just like the IDE did. For example, you'll typically use it when you need to build the skeleton of a class but you don't want to fill in all the code yet. That way, if your program throws that exception, you know it's because you still need to finish the code, and not because your program is broken. {507} step 2, header line Change "The BallÕs constructor" to "The BatÕs constructor" (522) first annotation Change "Alive, Alive," to "Alive," (word is repeated unnecesarily) {524} 14th line of code change "this.ID = ID;" to "this.ID = id;" (second "id" should be lowercase) {530} bottom of page change this: public bool AddHoney(double Nectar) { return true; } public bool ConsumeHoney(double Amount) { return true; } to this: public bool AddHoney(double nectar) { return true; } public bool ConsumeHoney(double amount) { return true; } (530) add an annotation at the bottom of the page You could also throw a NotImplementedException in any method you haven't implemented yet. That's a great way to keep track of code you still have to build. {548} rightmost annotation, middle of page change "200 times a second" to "20 times a second" {550} fifth-to-last line of code after the line that says "framesRun = 0;" add this: world = new World(); {553} top annotation Change this: "Hive required some changes, as well." To this: "The World class required some changes, as well." {556} There should be a "Watch it!" box to the space in the upper righthand corner of the page warning that LINQ doesn't work with old versions of C# and Visual Studio. It should contain this text: "LINQ is a new feature thatÕs part of C# 3.0 and Visual Studio 2008. If youÕre using an earlier version of C#, take a few minutes to download and install Visual C# 2008 Express Edition. ItÕs free from Microsoft, and it can be installed alongside previous versions." (576) "Behind the Scenes" box, fourth line of text Remove the text "implements the" and "some" -- so it should just be "That class has members which should be pretty familiar..." {581} step 5, code The line "if (!beeLookup.ContainsKey(bee)) {" is repeated twice -- the second one is indented. Delete the first line, and unindent the next five lines so that the if statement lines up with the "} else" statement, and the other four statements line up with the last line {582} bottom line of text and top line of code Change the two instances of "ResetLocations()" to "InitializeLocations()". (582) second-to-last paragraph change the first paragraph from this: "Now you can run the form, and click on the location of the hive. That will give you a set of coordinates for your hive on the field" to this: "Once you've added the MouseClick event handler to the form, you can run the program. Once it's running, click on the exit of the hive in the picture. The event handler will pop up a message box that shows you the exact coordinates of the spot that you clicked!" (582) After the text "to add your new BeeControl user control." add this: "The UserControl has a .cs file, a .designer.cs file and a .resx file -- you'll need to add all three. Then open up the code for both the .cs and .designer.cs files, and change the namespace lines so they match the namespace of your new project. Rebuild your project; the BeeControl should now show up in the toolbox. You'll also need to add the graphics to the new project's resources." The rest of the paragraph is fine as written {583} bottom annotation change "It calls the RemoveAllControls() method" to "It calls each form's Controls.Remove() method" {591} step 4, second line of body text Remove this text: "Ń-and change the BackgroundImageLayout property to None" {592} bottom block of code, 7th line Change this line: beePicture.Image = ResizeImage( to this: beePicture.Image = Renderer.ResizeImage( (601) - body text at the top of the page Change the body text at the top of the page to this: "Remember those pesky graphics glitches? Well, DrawImage() is the key to fixing the problem in the renderer where the images were drawing those boxes around the bees and flowers that caused the overlap issues. So letÕs tackle them! We'll start out by going back to your Windows application with the picture and changing it to draw a bunch of bees that overlap each other without any graphics glitches." {603} step 1, 4th line change "Horizontal" to "Vertical" (625) third annotation change the text: "...a line from the clone factory to the Superhero object..." to this: "...a line from the clone factory to the Villain object..." {629} fourth-to-last line, at the end of its paragraph Change this: GC.collect(). to this: GC.Collect(). {657} second line of body text change: System.Collections.Generic.IEnumerable to: System.Collections.Generic.IEnumerable {662} bottom annotation Remove the top arrow that's pointing to Count()