Need Help on this Bank Program!

Hi! I am a UG student of Computer Engineering and It would be nice if someone could help me on this C# project that i want to create just for educational purpose. I have a average C and C++ programming knowledge. But I am new to the C# or .Net for that matter.

I have rough or pitty good idea on the concept behind this program because I have done program in C++ that does same thin except the fact that it runs on console or DOS. But I am finding hard on C# and I am stuck on the very first step that is creating a account and assigning it to the array of object.

Till now there are 2 window form on my Program. First with 'create new Account Button' and when user clicks on that button another form shows up with textbox for inputing NAME, Password and intial Amount.

Here is my code...



[code]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
static class Program
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

[/code]



[code]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void bt1_Click(object sender, EventArgs e)
{
Form2 frm2 = new Form2();
frm2.Show();

}
}


static class global
{
public static int g1=104;
public static int getr
{
get
{
return g1;
}
set
{
g1 = value;
}
}
}

public class Bank
{
string name, pass;
Int64 bal; int accid;


public void create(string a, string b, int c)
{
name = a; pass = b; bal = c; accid = global.getr+1000;
global.getr=global.getr+1;

}

}



}

[/code]



[code]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}

private void bt2_Click(object sender, EventArgs e)
{
int uni = global.getr;
string x, y; int z;
x = Nam.Text; y = Pass.Text; z = Convert.ToInt32(Amount.Text);
Bank[] b1 = new Bank[100];
b1[uni].create(x,y,z);


}

private void Form2_Load(object sender, EventArgs e)
{

}


}
}

[/code]



For Designer Code.....



[code]
namespace WindowsFormsApplication1
{
partial class Form1
{
///
/// Required designer variable.
///
private System.ComponentModel.IContainer components = null;

///
/// Clean up any resources being used.
///
/// true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.bt1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// bt1
//
this.bt1.Location = new System.Drawing.Point(27, 46);
this.bt1.Name = "bt1";
this.bt1.Size = new System.Drawing.Size(102, 61);
this.bt1.TabIndex = 0;
this.bt1.Text = "Open Account";
this.bt1.UseVisualStyleBackColor = true;
this.bt1.Click += new System.EventHandler(this.bt1_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(100, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(81, 13);
this.label1.TabIndex = 1;
this.label1.Text = "This is my Bank";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 268);
this.Controls.Add(this.label1);
this.Controls.Add(this.bt1);
this.Name = "Form1";
this.Text = "My Bank";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.Windows.Forms.Button bt1;
private System.Windows.Forms.Label label1;
}
}


[/code]



[code]
namespace WindowsFormsApplication1
{
partial class Form2
{
///
/// Required designer variable.
///
private System.ComponentModel.IContainer components = null;

///
/// Clean up any resources being used.
///
/// true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.Nam = new System.Windows.Forms.TextBox();
this.Pass = new System.Windows.Forms.TextBox();
this.Amount = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.bt2 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// Nam
//
this.Nam.Location = new System.Drawing.Point(76, 34);
this.Nam.Name = "Nam";
this.Nam.Size = new System.Drawing.Size(204, 20);
this.Nam.TabIndex = 0;
//
// Pass
//
this.Pass.Location = new System.Drawing.Point(76, 106);
this.Pass.Name = "Pass";
this.Pass.Size = new System.Drawing.Size(204, 20);
this.Pass.TabIndex = 2;
//
// Amount
//
this.Amount.Location = new System.Drawing.Point(76, 71);
this.Amount.Name = "Amount";
this.Amount.Size = new System.Drawing.Size(204, 20);
this.Amount.TabIndex = 1;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(8, 37);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(35, 13);
this.label1.TabIndex = 3;
this.label1.Text = "Name";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(8, 109);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 13);
this.label2.TabIndex = 4;
this.label2.Text = "Password";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(8, 74);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(43, 13);
this.label3.TabIndex = 5;
this.label3.Text = "Amount";
//
// bt2
//
this.bt2.Location = new System.Drawing.Point(76, 190);
this.bt2.Name = "bt2";
this.bt2.Size = new System.Drawing.Size(203, 38);
this.bt2.TabIndex = 6;
this.bt2.Text = "I Accept";
this.bt2.UseVisualStyleBackColor = true;
this.bt2.Click += new System.EventHandler(this.bt2_Click);
//
// Form2
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 268);
this.Controls.Add(this.bt2);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.Amount);
this.Controls.Add(this.Pass);
this.Controls.Add(this.Nam);
this.Name = "Form2";
this.Text = "Please Fill the Form";
this.Load += new System.EventHandler(this.Form2_Load);
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.Windows.Forms.TextBox Nam;
private System.Windows.Forms.TextBox Pass;
private System.Windows.Forms.TextBox Amount;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button bt2;
}
}

[/code]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories