TUGAS MATAKULIAH PEMROGRAMAN
VISUAL I
Membuat Program
Penghitung Keliling Persegi Panjang, Deteksi Mahasiswa, dan Program Pengedit
File (Copy, Moving and Delete File)
Disusun oleh :
Nama :
Rania Lana Rifat
Kelas :
SI 12 A
NIM :
12.12.0011
STIMIK AMIKOM
PURWOKERTO
Tahun Akademik
2012/2013
========================================================================
Program Penghitung Keliling Persegi
Panjang
Daftar Kontrol dan Properti yang
Digunakan
Kontrol
|
Properti
|
Form1
|
Name : frmHitung
Maximize Box : False
Start Position : Center
Screen
Text : Program
Penghitung
Keliling Persegi Panjang
|
Label1
|
Text : Panjang
|
Label2
|
Text : Lebar
|
Text Box1
|
Name :
txtPanjang
|
Text Box2
|
Name : txtLebar
|
Text Box3
|
Name :
txtKeliling
|
Button1
|
Name : cmdHitung
Text : Hitung
Keliling
|
Error Provider
|
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
Penghitung_Keliling_PP
{
public partial class frmPenghitung : Form
{
public frmPenghitung()
{
InitializeComponent();
}
private void label3_Click(object
sender, EventArgs e)
{
}
private void cmdHitung_Click(object
sender, EventArgs e)
{
if (txtPanjang.Text ==
"")
{
errorProvider1.SetError(txtPanjang, "isikan nilai panjang!");
txtPanjang.Focus();
}
else if (txtLebar.Text ==
"")
{
errorProvider1.SetError(txtLebar, "isikan nilai lebar!");
txtLebar.Focus();
}
else
{
txtKeliling.Text = (2 *
(int.Parse(txtPanjang.Text) + int.Parse(txtLebar.Text))).ToString();
txtPanjang.Clear();
txtLebar.Clear();
errorProvider1.SetError(txtPanjang,
"");
errorProvider1.SetError(txtLebar,
"");
}
}
private void
txtKeliling_TextChanged(object sender, EventArgs e)
{
Console.Write(txtKeliling);
}
}
}
Program Deteksi Mahasiswa
Daftar Kontrol dan Properti yang
Digunakan
KONTROL
|
PROPERTI
|
Form
|
Name : Form1
Start Position : Center Screen
Maximixze Box : False
|
Label1
|
Text : NIM
|
Label2
|
Text : Tahun Angkatan
|
Label3
|
Text : Jurusan
|
Label4
|
Text : No. Urut
|
TeksBox1
|
Name : txtNIM
Enable : True
|
TeksBox2
|
Name : txtTA
Enable : False
|
TeksBox3
|
Name : txtJurusan
Enable : False
|
TeksBox4
|
Name : txtNu
Enable : False
|
======================================================
Program
Copy, Move, Delete File
Daftar
Kontrol dan Properti yang Digunakan
Kontrol
|
Properti
|
Form
|
Name
: form1
Text
: prakktikum 5
Start
Position : Center Screen
Maximize
Box : False
|
Label1
|
Text
: Source
|
Label2
|
Text
: Destination
|
Text
Box1
|
Name
: textBox1
|
Text
Box2
|
Name
: textBox2
|
Button1
|
Name
: button1
Text
: browse
|
Button2
|
Name
: button2
Text
: browse
|
Button3
|
Name
: button3
Text
: copy file
|
Button4
|
Name
: button4
Text
: move file
|
Button5
|
Name
: button5
Text
: delete file
|
Group
Box
|
Name
: groupBox1
|
OpenFile
Dialog
|
|
SaveFileDialog
|
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