0% found this document useful (0 votes)
13 views

Codingan Quiz

Uploaded by

Rama Dhani
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Codingan Quiz

Uploaded by

Rama Dhani
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Nama: Ramadhani

Nim: 2104030004

Codingan:

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;
using System.Diagnostics;

namespace Pemrograman_Jaringan_A5_part1
{
public partial class Quiz_Ramadhani : Form
{
private Stopwatch Jam = null;

public Quiz_Ramadhani()
{
InitializeComponent();
}

private void groupBox1_Enter(object sender, EventArgs e)


{

//===================================

private void textBox1_TextChanged(object sender, EventArgs e)


{

private void textBox2_TextChanged(object sender, EventArgs e)


{

}
private void textBox3_TextChanged(object sender, EventArgs e)
{

}
private void textBox4_TextChanged(object sender, EventArgs e)
{

private void timer1_Tick(object sender, EventArgs e)


{
if (Jam != null)
{
label6.Text = Jam.Elapsed.ToString(@"hh\:mm\:ss");
//textBox4.Text = Jam.Elapsed.ToString(@"hh\:mm\:ss");
//textBox4.Text = label6.Text;
}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs


e)
{
string selectedItem = comboBox1.SelectedItem.ToString();

switch (selectedItem)
{
case "Regular":
textBox2.Text = "1 Jam";
textBox3.Text = "Rp. 2000";
break;
case "Hemat":
textBox2.Text = "5 Jam";
textBox3.Text = "Rp. 9000";
break;
case "Game 1":
textBox2.Text = "2 Jam";
textBox3.Text = "Rp. 5000";
break;
case "Game 2":
textBox2.Text = "4 Jam";
textBox3.Text = "Rp. 9000";
break;
default:
textBox2.Text = "Silakan pilih jam.";
break;
}
}

private void label6_Click(object sender, EventArgs e)


{
textBox4.Text = Jam.Elapsed.ToString(@"hh\:mm\:ss");
}

private void button1_Click(object sender, EventArgs e)


{
if (string.IsNullOrEmpty(textBox1.Text))
{
MessageBox.Show("Silakan isi nama terlebih dahulu!");
return; // Menghentikan eksekusi jika nama tidak diisi
}
Jam = new Stopwatch();
Jam.Start();
button1.Enabled = false;

private void button2_Click(object sender, EventArgs e)


{
if (Jam != null && Jam.IsRunning)
{
Jam.Stop();
}
textBox4.Text = label6.Text;// Menampilkan hasil timer di
`textbox4`
label6.Text = "00:00:00";// label6.Text diatur ulang menjadi
"00:00:00"

button1.Enabled = true;

}
}
}

You might also like