Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

MATERI PEMROGRAMAN VISUAL NET

List barang

KODE NAMA BARANG HARGA BARANG


BARANG
A01 BUKU GAMBAR 5000
B02 BUKU TULIS 3000
C03 PULPEN 3500
D04 PENSIL 2000
E05 PENGGARIS 4500

LISTING PROGRAM
public partial class MainForm : Form
{
int harga, jmlh, total;

public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();

//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
void ComboBox1SelectedIndexChanged(object sender, EventArgs e)
{
textBox1.Enabled=false;
textBox2.Enabled=false;
textBox3.Enabled=false;

object nilai = comboBox1.SelectedItem;


string kode = nilai.ToString();
if ( kode == "A01")
{
textBox1.Text = "BUKU GAMBAR";
harga = 5000;
textBox2.Text = Convert.ToString(harga);

}
}
void Button1Click(object sender, EventArgs e)
{
if (radioButton1.Checked==true)
{
total = harga *1;

}
else if(radioButton2.Checked==true)
{
total = harga*2;

else if (radioButton3.Checked==true)
{
total = harga * 3;

}
textBox3.Text = Convert.ToString(total);
}
void Button2Click(object sender, EventArgs e)
{
Application.Exit();
}
}

You might also like