Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3
This is the forum to discuss the Wrox book Beginning C# 3.0 : An Introduction to Object Oriented Programming by Jack Purdum; ISBN: 9780470261293
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 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
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 3rd, 2010, 11:12 AM
Registered User
 
Join Date: Mar 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default ch 3 page 58

im not getting any result..


Code:
using System;
using System.Windows.Forms;

public class frmMain : Form
{
    private Label label1;
    private Label label2;
    private TextBox txtOperand1;
    private TextBox txtOperand2;
    private TextBox txtResult;
    private Button btnExit;
    private Button btnCalc;
    #region Windows Code
    private void InitializeComponent()
    {
        this.btnCalc = new System.Windows.Forms.Button();
        this.label1 = new System.Windows.Forms.Label();
        this.label2 = new System.Windows.Forms.Label();
        this.txtOperand1 = new System.Windows.Forms.TextBox();
        this.txtOperand2 = new System.Windows.Forms.TextBox();
        this.txtResult = new System.Windows.Forms.TextBox();
        this.btnExit = new System.Windows.Forms.Button();
        this.SuspendLayout();
        // 
        // btnCalc
        // 
        this.btnCalc.Location = new System.Drawing.Point(12, 85);
        this.btnCalc.Name = "btnCalc";
        this.btnCalc.Size = new System.Drawing.Size(76, 23);
        this.btnCalc.TabIndex = 0;
        this.btnCalc.Text = "Resultat";
        this.btnCalc.UseVisualStyleBackColor = true;
        // 
        // label1
        // 
        this.label1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
        this.label1.Location = new System.Drawing.Point(12, 7);
        this.label1.Name = "label1";
        this.label1.Size = new System.Drawing.Size(65, 20);
        this.label1.TabIndex = 1;
        this.label1.Text = "label1";
        // 
        // label2
        // 
        this.label2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
        this.label2.Location = new System.Drawing.Point(12, 33);
        this.label2.Name = "label2";
        this.label2.Size = new System.Drawing.Size(65, 20);
        this.label2.TabIndex = 2;
        this.label2.Text = "label2";
        // 
        // txtOperand1
        // 
        this.txtOperand1.Location = new System.Drawing.Point(82, 7);
        this.txtOperand1.Name = "txtOperand1";
        this.txtOperand1.Size = new System.Drawing.Size(100, 20);
        this.txtOperand1.TabIndex = 3;
        // 
        // txtOperand2
        // 
        this.txtOperand2.Location = new System.Drawing.Point(82, 33);
        this.txtOperand2.Name = "txtOperand2";
        this.txtOperand2.Size = new System.Drawing.Size(100, 20);
        this.txtOperand2.TabIndex = 4;
        // 
        // txtResult
        // 
        this.txtResult.Location = new System.Drawing.Point(12, 59);
        this.txtResult.Name = "txtResult";
        this.txtResult.ReadOnly = true;
        this.txtResult.Size = new System.Drawing.Size(170, 20);
        this.txtResult.TabIndex = 5;
        // 
        // btnExit
        // 
        this.btnExit.Location = new System.Drawing.Point(106, 85);
        this.btnExit.Name = "btnExit";
        this.btnExit.Size = new System.Drawing.Size(76, 23);
        this.btnExit.TabIndex = 6;
        this.btnExit.Text = "button2";
        this.btnExit.UseVisualStyleBackColor = true;
        // 
        // frmMain
        // 
        this.ClientSize = new System.Drawing.Size(194, 113);
        this.Controls.Add(this.btnExit);
        this.Controls.Add(this.txtResult);
        this.Controls.Add(this.txtOperand2);
        this.Controls.Add(this.txtOperand1);
        this.Controls.Add(this.label2);
        this.Controls.Add(this.label1);
        this.Controls.Add(this.btnCalc);
        this.Name = "frmMain";
        this.Load += new System.EventHandler(this.frmMain_Load);
        this.ResumeLayout(false);
        this.PerformLayout();

    }
    #endregion

    public frmMain()
    {
        InitializeComponent();
    }


    private void btnCalc_Click(object sender, EventArgs e)
    {
        bool flag;
        int operand1;
        int operand2;
        int answer;
        // Input Step
        // Check first input...
        flag = int.TryParse(txtOperand1.Text, out operand1);
        if (flag == false)
        {
            MessageBox.Show("Enter a whole number", "Input Error");
            txtOperand1.Focus();
            return;
        }
        // Check second input...
        flag = int.TryParse(txtOperand2.Text, out operand2);
        if (flag == false)
        {
            MessageBox.Show("Enter a whole number", "Input Error");
            txtOperand2.Focus();
            return;
        }
        // Process Step
        answer = operand1 / operand2;
        // Display Step
        txtResult.Text = operand1.ToString() + " divided by " +
                operand2.ToString() +
                " equals " + answer.ToString();
        txtResult.Visible = true;
    }
    private void btnExit_Click(object sender, EventArgs e)
    {
        Close();
    }

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



    private void frmMain_Load(object sender, EventArgs e)
    {

    }


}

where is the problem?
  #2 (permalink)  
Old March 3rd, 2010, 11:34 AM
Registered User
 
Join Date: Mar 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i found the solution ..
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Big problem discovered at page 58 "Creating Simple Links" Antares BOOK: Beginning HTML, XHTML, CSS, and JavaScript 6 February 23rd, 2010 07:25 PM
Error code in page 58(PDF) line 7 patriot074 BOOK: Professional ASP.NET MVC 1.0 ISBN: 978-0-470-38461-9 5 April 30th, 2009 08:17 PM
CH 5 Page 153 zamankazi BOOK: ASP.NET Website Programming Problem-Design-Solution 8 November 4th, 2004 08:38 AM
PhilePage Class on p. 58 JeffSpitzer BOOK: ASP.NET Website Programming Problem-Design-Solution 0 February 8th, 2004 09:08 AM
Page 58 - Class or Classlibrary? stuckish BOOK: ASP.NET Website Programming Problem-Design-Solution 1 February 8th, 2004 09:01 AM



All times are GMT -4. The time now is 11:36 PM.


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