Widget

Minggu, 11 November 2012

Pemrograman Visual 1


Aplikasi penghitung Luas dan Keliling Persegi Panjang
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 fHitung : Form
    {

        String pilih;
        Decimal hasil;
        public fHitung()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }


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

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

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

        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 * lebar;
            }

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

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

        }
    }
}


Aplikasi Kemahasiswaan


Membuat aplikasi Copy Move Delete
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.IO;
using System.Text;
using System.Windows.Forms;

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

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

        //browse2
        private void button2_Click_1(object sender, EventArgs e)
        {
            string simpan = "";
            saveFileDialog1.Filter = "All Files(*.*)|*.*";
            saveFileDialog1.ShowDialog();
            simpan = saveFileDialog1.FileName;
            textBox2.Text = (simpan);
        }
        //delete file
        private void button5_Click_1(object sender, EventArgs e)
        {
            MessageBox.Show("Apa anda yakin ingin menghapus ?");
            File.Delete(textBox1.Text);
        }
        //moving file
        private void button4_Click_1(object sender, EventArgs e)
        {
            MessageBox.Show("Apa anda yakin ingin memindahkan?");
            File.Move(textBox1.Text, textBox2.Text);
        }
        //copy file
        private void button3_Click_1(object sender, EventArgs e)
        {

            MessageBox.Show("Apa anda yakin ingin mengopy?");
            File.Copy(textBox1.Text, textBox2.Text);
        }
       }
    }



Tidak ada komentar:

Posting Komentar