0% found this document useful (0 votes)
36 views6 pages

Form1 Form: Using Using Using Using Using Using Using Using Using Namespace Public Partial Class Public

The document contains code from multiple C# Windows Forms applications that demonstrate different concepts: 1) A login form application that validates a username and password on button click. 2) An application that changes the text on a label based on the selected language in a combo box. 3) A library loan application that sets a return date based on the loan date. 4) A restaurant menu application that calculates totals and applies discounts based on menu selections. 5) An application that checks for a discount based on the selected date. 6) A timer application that counts down and displays the time remaining.

Uploaded by

Eliezer Lazuardi
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)
36 views6 pages

Form1 Form: Using Using Using Using Using Using Using Using Using Namespace Public Partial Class Public

The document contains code from multiple C# Windows Forms applications that demonstrate different concepts: 1) A login form application that validates a username and password on button click. 2) An application that changes the text on a label based on the selected language in a combo box. 3) A library loan application that sets a return date based on the loan date. 4) A restaurant menu application that calculates totals and applies discounts based on menu selections. 5) An application that checks for a discount based on the selected date. 6) A timer application that counts down and displays the time remaining.

Uploaded by

Eliezer Lazuardi
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/ 6

using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

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

private void btnlogin_Click(object sender, EventArgs e)


{
if ((String.Equals(this.txtuser.Text, "Eliezer")) &&
(String.Equals(this.mtxpassword.Text, "admin")))
{
Form2 f = new Form2();
f.Show();
this.Hide();
}
else
{
MessageBox.Show("Incorrect User Name Or Password", "Error");
}
}
}
}

Bahasa

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

private void comboBoxbahasa_SelectedIndexChanged(object sender, EventArgs e)


{
if (this.comboBoxbahasa.SelectedIndex == 0) //Indonesia
{
this.lbltrims.Text = "Terima Kasih";
}
else if (this.comboBoxbahasa.SelectedIndex == 1) //Inggris
{
this.lbltrims.Text = "Thank You";
}
else if (this.comboBoxbahasa.SelectedIndex == 2) //Jepang
{
this.lbltrims.Text = "Arigato";
}
else if (this.comboBoxbahasa.SelectedIndex == 3) //Jerman
{
this.lbltrims.Text = "Danke";
}
else if (this.comboBoxbahasa.SelectedIndex == 4) //Mandarin
{
this.lbltrims.Text = "Xie Xie Ni";
}
else if (this.comboBoxbahasa.SelectedIndex == 5) //Spanyol
{
this.lbltrims.Text = "Gracias";
}
else if (this.comboBoxbahasa.SelectedIndex == 6) //Batak
{
this.lbltrims.Text = "Mauliate";
}
else if (this.comboBoxbahasa.SelectedIndex == 7) //Planet
{
this.lbltrims.Text = "Uvuvwevwevwe Onyetentevwe Ugwemubwem Osas";
}
String pilihan = (string)this.comboBoxbahasa.SelectedItem;
}

Perpustakaan

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

private void Form1_Load(object sender, EventArgs e)


{

private void dtppinjam_ValueChanged(object sender, EventArgs e)


{
this.dtpkembali.Value = this.dtppinjam.Value.AddDays(7);
}

private void btnsimpan_Click(object sender, EventArgs e)


{
string pesan;
pesan = "Buku dengan Kode :";
pesan = pesan + this.txtkode.Text;
pesan= pesan+"\nPinjam :";
pesan = pesan + this.dtppinjam.Value;
pesan = pesan + "\nKembali :";
pesan = pesan + this.dtpkembali.Value;
MessageBox.Show(pesan);

}
}
Resto

namespace MenuRestoran
{
public partial class frmmenurestoran : Form
{
public frmmenurestoran()
{
InitializeComponent();
}

private void textBox1_TextChanged(object sender, EventArgs e)


{

private void chkchicken_CheckedChanged(object sender, EventArgs e)


{
if (this.chbmenu2.Checked == true)
{
this.txtmenu2.Visible = true;
}
else
{
this.txtmenu2.Visible = false;
}

private void lbltotalinfo_Click(object sender, EventArgs e)


{

private void label2_Click(object sender, EventArgs e)


{

private void textBox2_TextChanged(object sender, EventArgs e)


{

private void label1_Click(object sender, EventArgs e)


{

private void chbmenu1_CheckedChanged(object sender, EventArgs e)


{
if (this.chbmenu1.Checked == true)
{
this.txtmenu1.Visible = true;
}
else
{
this.txtmenu1.Visible = false;
}

private void chbmenu3_CheckedChanged(object sender, EventArgs e)


{
if (this.chbmenu3.Checked == true)
{
this.txtmenu3.Visible = true;
}
else
{
this.txtmenu3.Visible = false;
}

private void rbtplgya_CheckedChanged(object sender, EventArgs e)


{

private void btnpesan_Click(object sender, EventArgs e)


{
double biaya = 0, diskon;
int menu1, menu2, menu3;
if (this.rbtplgya.Checked)
{
diskon = 0.1;
}
else
{
diskon = 0;
}
if (chbmenu1.Checked)
{
menu1 = int.Parse(this.txtmenu1.Text);
biaya += (8000 * menu1);
}
if (chbmenu2.Checked)
{
menu2 = int.Parse(this.txtmenu2.Text);
biaya += (7000 * menu2);
}
if (chbmenu3.Checked)
{
menu3 = int.Parse(this.txtmenu3.Text);
biaya += (4000 * menu3);
}
biaya -= (biaya * diskon);
this.lbltotal.Text = biaya.ToString();
}
}
}

Diskon

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

private void btncheck_Click(object sender, EventArgs e)


{
int a, b;
a = dtp1.Value.Day;
b = dtp1.Value.Month;
if ((a > 5) && (b == 12))
{
label1.Text = "DISCOUNT";
}
else
{
label1.Text="PROGRAM UTAMA";
}
}
}
}

timer

namespace TIMER
{
public partial class Form1 : Form
{
public int detik;
public Form1()
{
InitializeComponent();
}

private void btnstart_Click(object sender, EventArgs e)


{
this.lbldetik.Text=this.txtdetik.Text;
this.detik= Convert.ToInt32(this.txtdetik.Text);
this.tmrhitung.Enabled=true;

private void btnstop_Click(object sender, EventArgs e)


{
this.tmrhitung.Enabled=false;
}

private void btnreset_Click(object sender, EventArgs e)


{
this.lbldetik.Text=this.txtdetik.Text;
this.detik= Convert.ToInt32(this.txtdetik.Text);
}

private void tmrhitung_Tick(object sender, EventArgs e)


{
if (detik > 0)
{
detik--;
this.lbldetik.Text = Convert.ToString(detik);
}
else
{
this.tmrhitung.Enabled = false;
MessageBox.Show("Waktu Habis", "Info");
}
}

private void btnexit_Click(object sender, EventArgs e)


{
Application.Exit(); } } }

You might also like