Network Programing

Sabtu, 06 Mei 2017

NOTEPAD



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

        private void richTextBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            richTextBox1.Clear();
        }

        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog op = new OpenFileDialog();
            if (op.ShowDialog() == DialogResult.OK)
                richTextBox1.LoadFile(op.FileName, RichTextBoxStreamType.PlainText);
            this.Text = op.FileName;
        }

        void simpan()
        {
            SaveFileDialog op = new SaveFileDialog();
            op.Filter = "Text Document(*.txt)|*.txt|All Files(*.*)|*.*";
            if (op.ShowDialog() == DialogResult.OK)
                richTextBox1.SaveFile(op.FileName, RichTextBoxStreamType.PlainText);
            this.Text = op.FileName;
        }

        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            simpan();
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Close();
        }

        void bersihkan()
        {
            richTextBox1.Text = "";
        }

    }
}

BILLING



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;
using System.Diagnostics;

namespace biling
{
    public partial class Form1 : Form
    {
        private Stopwatch wkt = null;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "")
            {
                wkt = new Stopwatch();
                if (button1.Text == "login")
                {
                    if (radioButton1.Checked)
                    {
                        label3.Text = "1 jam";
                    }
                    else if (radioButton2.Checked)
                    {
                        label3.Text = "5 jam";
                    }
                    label2.Visible = true;
                    wkt.Start();
                    button1.Text = "Stop";
                }
                else if (button1.Text == "Stop")
                {
                    wkt.Start();
                    if (radioButton1.Checked)
                    {
                        MessageBox.Show("Jumlah tagihan anda sebesar Rp 2000", "Total Tagihan Paket Regular");
                    }
                    if (radioButton2.Checked)
                    {
                        MessageBox.Show("Jumlah Tagihan anda sebesar Rp 9000", "Total Tahihan Paket Hemat");
                    }
                    wkt.Reset();
                    label2.Visible = false;
                    button1.Text = "login";
                    textBox1.Text = null;
                }
            }
            else if (textBox1.Text == "")
            {
                MessageBox.Show("Nama Harus Diisi!!!", "Important Message");
            }


        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (wkt != null)
            {
                label2.Text = wkt.Elapsed.ToString(@"hh\:mm\:ss");
            }

        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

     
    }
}
STOPWATCH



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();
        }
        int hour, min, sec, ms = 0;

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            timer1.Start();
            button3.Enabled = false;

        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button3_Click(object sender, EventArgs e)
        {
            jam.Text = 00.ToString();
            label1.Text = 00.ToString();
            label2.Text = 00.ToString();
            label3.Text = 00.ToString();

           
            ms = 0;
            hour = 0;
            min = 0;
            sec =0;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            jam.Text = hour.ToString();
            label1.Text = min.ToString();
            label2.Text = sec.ToString();
            label3.Text = ms.ToString();

            ms++;
            if (ms > 10)
            {
                sec++;
                ms = 0;
            }
            else
            {
                ms++;
            }
            if (sec > 60)
            {
                min++; sec = 0;
            }
            if (min > 60)
            {
                hour++;
                min = 0;
            }

        }

        private void button2_Click(object sender, EventArgs e)
        {
            timer1.Stop();
            button3.Enabled = true;

        }
    }
}

 

My Blog List