Monday, April 15, 2013

Bill in C# using Form Application


Generate Electric Bill in C#

Objective:

Write a program in Wnindows Form Application. Generate electric  bill, input User Name and pasword 12345, login and enter information required to generate bill.

Coding Form 1:
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 Suigas
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox2.Text == "12345")
            {
                Form2 f2 = new Form2();
                f2.Show();
                Hide();
            }
        
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}



Coding Form 2:
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 Suigas
{
    public partial class Form2 : Form
    {
        public static string name, type, address;
        public static double cunit, punit, conUnit, prsUnit, ttlbill, mtrno, units;



        public Form2()
        {
            InitializeComponent();
        }

        private void Form2_Load(object sender, EventArgs e)
        {

        }


        private void button1_Click(object sender, EventArgs e)
        {
            name = textBox1.Text;
            mtrno = (Convert.ToDouble(textBox2.Text));
            address = textBox3.Text;
            punit = (Convert.ToDouble(textBox4.Text));
            cunit = (Convert.ToDouble(textBox5.Text));
            type = textBox6.Text;
            conUnit = punit - cunit;

            if ((type == "commercial") || (type == "Commercial"))
            {
                prsUnit = 8.0;
                conUnit = cunit - punit;
                ttlbill = prsUnit * conUnit;
            }
            else
            {
                prsUnit = 4.0;
                conUnit = cunit - punit;
                ttlbill = prsUnit * conUnit;
            }

            Form3 f3 = new Form3();
            f3.Show();
            Hide();

        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
        }
    }   
}



Coding Form 3:
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 Suigas
{
    public partial class Form3 : Form
    {
        public static double m, pc, amt;
        public static string t;
        public static string nme, ad;

        public Form3()
        {
            InitializeComponent();
        }

        private void Form3_Load(object sender, EventArgs e)
        {

            nme = Form2.name;
            label1.Text = nme.ToString();

            ad = Form2.address;
            label2.Text = ad.ToString();

            m = Form2.mtrno;
            label3.Text = m.ToString ();

            pc = Form2.conUnit;
            label4.Text = pc.ToString();

            t = Form2.type;
            label5.Text = t.ToString();

            amt = Form2.ttlbill;
            label6.Text = amt.ToString();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void label12_Click(object sender, EventArgs e)
        {

        }
     }
}




4 comments:

  1. Really good information, Thanks for sharing valuable information. you can pay easily online bill payments click below links.
    Best Bill payment app in india
    TNEB electricity bill payment online
    best mobile payment app
    Broadband bill
    Gas Bill

    ReplyDelete


  2. Really good post. Thanks for sharing this wonderful informative article. I prefer the XPay life app is one of the best for all utility bill payments in India and also XPay life India’s first black chain secured app You can pay all your utility bills through XPay life and get more cashback's. you can pay easily online and offline bill payment clicks below links.

    Gas Bill Online
    TV Online Recharge
    Airtel Postpaid Bill Payment
    Quick Bill Payment Electricity
    QR Code Bill Payment

    ReplyDelete
  3. Really good information, Thanks for sharing valuable information. you can pay easily online bill payments click below links.
    cash accept machine kiosk
    TNEB electricity bill payment online
    best mobile payment app
    Big tv online recharge
    Gas Bill

    ReplyDelete
  4. hello sir. I am new to learn the C#.
    can you tell me how we count the electricity bill like previous reading - current reading = consumption and then consumption x price - quota = total amount.

    thanks
    hope you can reply for help me to more learn.

    ReplyDelete