Jumat, 12 Desember 2014

coding mengitung luas & keliling persegi panjang microsoft visual studio


Ini ada Bantuan coding buat kalian yang pusing akan coding codingan ..



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 menghitung_luas_dan_keliling_persegi_panjang
{
    public partial class fHitung : Form
    {
        String pilih ;
        Decimal hasil;

        public fHitung()
        {
            InitializeComponent();
        }

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

        private void rdKeliling_CheckedChanged(object sender, EventArgs e)
        {
            if (this.rdKeliling.Checked == true)
            {
                rdLuas.Checked= false;
                pilih = "Keliling";
            }
        }

        private void rdLuas_CheckedChanged(object sender, EventArgs e)
        {
            if (this.rdLuas.Checked == true)
            {
                rdKeliling.Checked = false;
                pilih = "Luas";
            }           
        }

        private void cmdBatal_Click(object sender, EventArgs e)
        {
            txtLebar.Clear();
            txtPanjang.Clear();
            rdLuas.Checked = false;
            rdKeliling.Checked = false;
            txtPanjang.Focus();
            Application.Exit();
        }

        private void cmdProses_Click(object sender, EventArgs e)
        {

            decimal panjang, lebar;
            panjang = Decimal.Parse(this.txtPanjang.Text);           
            lebar = Decimal.Parse(this.txtLebar.Text);


                if (pilih == "Luas")
                {
                    hasil = panjang * panjang;

                }
                else if (pilih == "Keliling")
                {
                    hasil = ((2 * panjang) + (2 * lebar));
                }
              

             MessageBox.Show("Jadi " + pilih +" adalah " + hasil, "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information);
               
        }

               
    }
}


Tugas membuat Program Copy Paste

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.IO;

namespace Copas
{
    public partial class FCopier : Form
    {
        public FCopier()
        {
            InitializeComponent();
        }

        private void btnBrows1_Click(object sender, EventArgs e)
        {
            string cari = "";
            openFileDialog1.Filter = "All Files(*.*)|*.*";
            openFileDialog1.ShowDialog();
            cari = openFileDialog1.FileName;
            textBox1.Text = (cari);

        }

        private void btnbrows2_Click(object sender, EventArgs e)
        {
            string simpan = "";
            saveFileDialog1.Filter = "All Files(*.*)|*.*";
            saveFileDialog1.ShowDialog();
            simpan = saveFileDialog1.FileName;
            textBox2.Text = (simpan);

        }

        private void btnCopy_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Apa anda yakin ingin mengopy");
            File.Copy(textBox1.Text, textBox2.Text);
        }

        private void btnMove_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Apa anda yakin ingin memindah");
            File.Move(textBox1.Text, textBox2.Text);
        }

        private void btnDelete_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Apa anda yakin ingin menghapus");
            File.Delete(textBox1.Text);
        }
    }
}



Tidak ada komentar:

Posting Komentar