p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   BOOK: Beginning Object-Oriented Programming with C# (http://p2p.wrox.com/book-beginning-object-oriented-programming-c-721/)
-   -   Chapter 2 Program 2 (http://p2p.wrox.com/book-beginning-object-oriented-programming-c/89146-chapter-2-program-2-a.html)

sapper January 14th, 2013 01:22 PM

Chapter 2 Program 2
 
Hello,

In the second Try it Out for Chapter 2 (program 02) the steps say the following:

Quote:

Use the same File -> New Project -> Visual C# -> Windows menu sequence discussed earlier in this chapter (refer to Figure 2-8).
Do we complete the full sequence sequence from step 1 through 10, including deleting the code in step 7 on page 34 and adding the code in step 8?

I ask this because in step 8 of the first Try it Out, we add the using System; and using System.Windows.Forms; code, yet in the second try it out we are asked in step 2 to add the same program references to the project through the Reference Manager. Should we be stopping at step 7 and then continuing at step 2 of the second try it out?

sapper January 14th, 2013 01:53 PM

I believe I have figured this out.

Using the example from Chapter02Program01, you only go up to step 2 and then carry on at step 2 of Chapter02Program02 on page 45. However, it does not produce the frmMain.cs [Design] at the top of the source windows in step 3 which is fine because its just being deleted anyways in Step 6. No error or issue is presented.

DrPurdum January 15th, 2013 11:47 AM

Chapter 2 fix -- additional
 
The process detailed in Chapter 2, starting on page 32, is one that is done for virtually every program you write. Since some readers are having difficulty with this section, I have written a very detailed set of instructions for the directions that start on page 32. I am providing these instruction under a new Post.

Brakkar April 11th, 2013 11:51 AM

Quote:

Originally Posted by sapper (Post 288818)
I believe I have figured this out.

Using the example from Chapter02Program01, you only go up to step 2 and then carry on at step 2 of Chapter02Program02 on page 45. However, it does not produce the frmMain.cs [Design] at the top of the source windows in step 3 which is fine because its just being deleted anyways in Step 6. No error or issue is presented.

I'm having a hard time with this book. I too do not get the frmMain.cs [design], nor can't I get it by right clicking on the frmMain on solution window as it is not there.
All I get when following the book is "frmMain.cs" with empty code window.

What i'm supposed to do ?

DrPurdum April 16th, 2013 01:40 PM

What to do after you get an empty frmMain
 
Once you've cleared out the code that VS puts in frmMain, add the C# template code into the empty form:
Code:

using System;
using System.Windows.Forms;

public class frmMain:Form
{
#region Windows Code
        private void InitializeComponent()
        {
        }
#endregion

        public frmMain()
        {
                InitializeComponent();
        }

        [STAThread]
        public static void Main()
        {
                frmMain main = new frmMain();
                Application.Run(main);
        }
}

Let me know how this works for you...

Brakkar April 18th, 2013 11:05 AM

Thanks, it works, i'm now on Chapter 5.

Brakkar April 18th, 2013 11:09 AM

By the way, it seems I can't unzip the files of chapter 5 , because of an "unknown" method.

Can you please check if the files work for you ? Or provide alternate download ?

DrPurdum April 21st, 2013 01:34 PM

Unipping
 
Sometimes I have problems with zip files, too. If the Windows zip utility doesn't work, I usually try 7-zip, which is a free download at:

http://download.cnet.com/7-Zip/3000-...-10045185.html

Between the two, one usually does the job.

jack3M January 5th, 2014 09:38 PM

I have a different issue with this exercise. I have done some coding in other languages, looking to learn OOP, so moved up from C to this.

On page 36 at the bottom, we are discussing changing the TEXT property of the label object. Ok, cool, got that no problem.

But on page 37 in the 2nd paragraph we start addressing a TEXTBOX object and a BUTTON object.

It took a very, very long time to figure out that I needed to add those objects from the tool box. I did learn, and got the solution because I was reading all the code put in by Visual Studio upon adding an object. If you don't put in the texbox, the line of code:
"frmMain.ActiveForm.Text = textBox1.Text;"
causes a error on compile. Once the textbox is added the failure stops.

I do think I would have preferred to know we were adding those objects somewhere before you start talking about them.

That said, I like your teaching style and this is the second of your books I am working on.

DrPurdum January 5th, 2014 10:31 PM

Chapter 2
 
Sorry for the confusion. This problem was discussed on an earlier thread and I just learned yesterday that no one at Wrox has updated the errata sheet according to those discussions. I've been told that will be fixed shortly. I'm glad that you were able to ferret out the problem yourself...always a good sign!

Thanks for the compliment on my teaching style...it's appreciated!


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

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