Posted by Brad Wed 29th Mar 2006 23:00 - Syntax is C# - 141 views
Download | New Post | Modify | Hide line numbers
Description:
type/namespace Account can not be found Line 26 and 24
Class 'Bankaccountforms.PayInForm' already defines a member called
'deposit_button_Click' with the same parameter types - line 121


  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6.  
  7. namespace Bankaccountforms
  8. {
  9.     ///
  10.     /// Summary description for PayInForm.
  11.     ///
  12.     public class PayInForm : System.Windows.Forms.Form
  13.     {
  14.         private System.Windows.Forms.Label deposit_label;
  15.         private System.Windows.Forms.TextBox deposit_textBox;
  16.         private System.Windows.Forms.Button deposit_button;
  17.         ///
  18.         /// Required designer variable.
  19.         ///
  20.  
  21.         private System.ComponentModel.Container components = null;
  22.  
  23.  
  24.         private Account inPayInFunds;
  25.  
  26.         public void PayInFundsForm( Account inPayInFunds)
  27.         {
  28.             //
  29.             // Required for Windows Form Designer support
  30.             //
  31.             InitializeComponent();
  32.  
  33.                 payInFunds = inPayInFunds;
  34.             AccountNumber.Text = currentAccount.GetAccountNumber();}
  35.  
  36.  
  37.  
  38.         private void deposit_button_Click(object sender, System.EventArgs e)
  39.         {
  40.             editAccount.PayInFunds(decimal.Parse(nameTextBox.Text));
  41.         {
  42.  
  43.             //
  44.             // Required for Windows Form Designer support
  45.             //
  46.  
  47.  
  48.             //
  49.             // TODO: Add any constructor code after InitializeComponent call
  50.             //
  51.         }
  52.         }
  53.  
  54.         ///
  55.         /// Clean up any resources being used.
  56.         ///
  57.         protected override void Dispose( bool disposing )
  58.         {
  59.             if( disposing )
  60.             {
  61.                 if(components != null)
  62.                 {
  63.                     components.Dispose();
  64.                 }
  65.             }
  66.             base.Dispose( disposing );
  67.         }
  68.  
  69.         #region Windows Form Designer generated code
  70.         ///
  71.         /// Required method for Designer support - do not modify
  72.         /// the contents of this method with the code editor.
  73.         ///
  74.         private void InitializeComponent()
  75.         {
  76.             this.deposit_label = System.Windows.Forms.Label();
  77.             this.deposit_textBox = System.Windows.Forms.TextBox();
  78.             this.deposit_button = System.Windows.Forms.Button();
  79.             this.SuspendLayout();
  80.             //
  81.             // deposit_label
  82.             //
  83.             this.deposit_label.Location = System.Drawing.Point(40, 16);
  84.             this.deposit_label.Name = "deposit_label";
  85.             this.deposit_label.Size = System.Drawing.Size(208, 40);
  86.             this.deposit_label.TabIndex = 0;
  87.             this.deposit_label.Text = "How much would you like to deposit??";
  88.             this.deposit_label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
  89.             //
  90.             // deposit_textBox
  91.             //
  92.             this.deposit_textBox.Location = System.Drawing.Point(112, 88);
  93.             this.deposit_textBox.Name = "deposit_textBox";
  94.             this.deposit_textBox.Size = System.Drawing.Size(56, 20);
  95.             this.deposit_textBox.TabIndex = 1;
  96.             this.deposit_textBox.Text = "�0.00";
  97.             //
  98.             // deposit_button
  99.             //
  100.             this.deposit_button.Location = System.Drawing.Point(96, 160);
  101.             this.deposit_button.Name = "deposit_button";
  102.             this.deposit_button.Size = System.Drawing.Size(88, 72);
  103.             this.deposit_button.TabIndex = 2;
  104.             this.deposit_button.Text = "Deposit";
  105.             this.deposit_button.Click += System.EventHandler(this.deposit_button_Click);
  106.             //
  107.             // PayInForm
  108.             //
  109.             this.AutoScaleBaseSize = System.Drawing.Size(5, 13);
  110.             this.ClientSize = System.Drawing.Size(292, 273);
  111.             this.Controls.Add(this.deposit_button);
  112.             this.Controls.Add(this.deposit_textBox);
  113.             this.Controls.Add(this.deposit_label);
  114.             this.Name = "PayInForm";
  115.             this.Text = "PayInForm";
  116.             this.ResumeLayout(false);
  117.  
  118.         }
  119.         #endregion
  120.  
  121.         private void deposit_button_Click(object sender, System.EventArgs e)
  122.         {
  123.             decimal payIn = 0;
  124.             bool flag = false;
  125.             try
  126.             {
  127.                 string stringPayIn = PayInAmmountOnForm.Text;
  128.                 payIn = decimal.Parse(stringPayIn);
  129.                 flag = true;
  130.             }
  131.             catch
  132.             {
  133.                 flag = false;
  134.                 MessageBox.Show ( "Please enter a value consisting of numbers only" );
  135.             }
  136.             if (flag)
  137.             {
  138.                 if (currentAccount.PayInFunds(payIn))
  139.                 {
  140.                     MessageBox.Show ("Pay in sucessfull" );
  141.                 }
  142.                 else
  143.                 {
  144.                     MessageBox.Show ( "Pay in failed" );
  145.                 }
  146.             }
  147.             Close();
  148.  
  149.         }
  150.     }
  151. }

PermaLink to this entry https://pastebin.co.uk/598
Posted by Brad Wed 29th Mar 2006 23:00 - Syntax is C# - 141 views
Download | New Post | Modify | Hide line numbers