0% found this document useful (0 votes)
30 views3 pages

Materi Pemrograman Visual Net: Kode Barang Nama Barang Harga Barang

This document contains code for a visual basic .NET program that calculates order totals. It includes a list of sample products with codes and prices. The program uses a combo box to select a product, which populates text boxes with the name and price from the list. Radio buttons allow selecting a quantity of 1, 2, or 3, and a button calculates the total by multiplying the price by the quantity. The program exits when another button is clicked.

Uploaded by

Moh Zuhri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views3 pages

Materi Pemrograman Visual Net: Kode Barang Nama Barang Harga Barang

This document contains code for a visual basic .NET program that calculates order totals. It includes a list of sample products with codes and prices. The program uses a combo box to select a product, which populates text boxes with the name and price from the list. Radio buttons allow selecting a quantity of 1, 2, or 3, and a button calculates the total by multiplying the price by the quantity. The program exits when another button is clicked.

Uploaded by

Moh Zuhri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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