Pendaftaran online (C#)

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 Tugas_VB_Via_Email
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            textBox1.Enabled = false;
            textBox2.Enabled = false;
            textBox3.Enabled = false;
            textBox4.Enabled = false;
            textBox5.Enabled = false;
            textBox6.Enabled = false;

            checkBox1.Enabled = false;
            checkBox2.Enabled = false;
            checkBox3.Enabled = false;
            checkBox4.Enabled = false;
            checkBox5.Enabled = false;
            checkBox6.Enabled = false;

            radioButton1.Enabled = false;
            radioButton2.Enabled = false;
            radioButton3.Enabled = false;
            radioButton4.Enabled = false;
            radioButton5.Enabled = false;
            radioButton6.Enabled = false;
            radioButton7.Enabled = false;
            radioButton8.Enabled = false;

            comboBox1.Enabled = false;
            comboBox2.Enabled = false;
            comboBox3.Enabled = false;

            numericUpDown1.Enabled = false;
            numericUpDown2.Enabled = false;

            button2.Enabled = false;
            button3.Enabled = false;
          
           
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (this.BackColor != SystemColors.MenuBar)
            {

                this.BackColor = SystemColors.MenuBar;

            }

            textBox1.Enabled = true;
            textBox2.Enabled = true;
            textBox3.Enabled = true;
            textBox4.Enabled = true;
            textBox5.Enabled = true;
            textBox6.Enabled = true;

            checkBox1.Enabled = true;
            checkBox2.Enabled = true;
            checkBox3.Enabled = true;
            checkBox4.Enabled = true;
            checkBox5.Enabled = true;
            checkBox6.Enabled = true;

            radioButton1.Enabled = true;
            radioButton2.Enabled = true;
            radioButton3.Enabled = true;
            radioButton4.Enabled = true;
            radioButton5.Enabled = true;
            radioButton6.Enabled = true;
            radioButton7.Enabled = true;
            radioButton8.Enabled = true;

            comboBox1.Enabled = true;
            comboBox2.Enabled = true;
            comboBox3.Enabled = true;

            numericUpDown1.Enabled = true;
            numericUpDown2.Enabled = true;

            button2.Enabled = true;
            button3.Enabled = true;
            button4.Enabled = true;

            textBox1.Focus();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (this.BackColor != SystemColors.MenuHighlight)
            {

                this.BackColor = SystemColors.MenuHighlight;

            }

            string jenis = "";
            string hobby = "";
            string jenjang = "";
            string tamat = "";

            if (radioButton1.Checked == true)
                jenis += "Pria";
            else if (radioButton2.Checked == true)
                jenis += "Perempuan";

            if (checkBox1.Checked == true)
                hobby += "Olah Raga, ";
            if (checkBox2.Checked == true)
                hobby += "Membaca, ";
            if (checkBox3.Checked == true)
                hobby += "Menulis, ";
            if (checkBox4.Checked == true)
                hobby += "Shopping, ";
            if (checkBox5.Checked == true)
                hobby += "Traveling, ";
            if (checkBox6.Checked == true)
                hobby += "Dll";

            if (radioButton3.Checked == true)
                jenjang += "SMA";
            else if (radioButton4.Checked == true)
                jenjang += "MA";
            else if (radioButton5.Checked == true)
                jenjang += "SMK";
            else if (radioButton6.Checked == true)
                jenjang += "PAKET C";

            if (radioButton7.Checked == true)
                tamat += "Sarjana";
            else if (radioButton8.Checked == true)
                tamat += "D III";

            listBox1.Items.Add("I. BIODATA");
            listBox1.Items.Add("Nama Lengkap : "+textBox1.Text);
            listBox1.Items.Add("Tempat Lahir : " + textBox2.Text);
            listBox1.Items.Add("Tanggal Lahir : " + numericUpDown1.Value+comboBox1.SelectedItem+numericUpDown2.Value);
            listBox1.Items.Add("Alamat : " + textBox3.Text);
            listBox1.Items.Add("Agama : " + comboBox2.SelectedItem);
            listBox1.Items.Add("Jenis Kelamin : " + jenis);
            listBox1.Items.Add("No. Telp/HP : " + textBox4.Text);
            listBox1.Items.Add("Alamat Email : " + textBox5.Text);
            listBox1.Items.Add("Hobby : " + hobby);
            listBox1.Items.Add("");
            listBox1.Items.Add("II. SLTA");
            listBox1.Items.Add("Jenjang : " + jenjang);
            listBox1.Items.Add("Lulusan Anda dari : " + textBox6.Text);
            listBox1.Items.Add("");
            listBox1.Items.Add("III. Prodi");
            listBox1.Items.Add("Tamat : " + tamat);
            listBox1.Items.Add("Jurusan : " + comboBox3.SelectedItem);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            textBox1.Text="";
            textBox2.Text = "";
            textBox3.Text = "";
            textBox4.Text = "";
            textBox5.Text = "";
            textBox6.Text = "";

            checkBox1.Checked=false;
            checkBox2.Checked = false;
            checkBox3.Checked = false;
            checkBox4.Checked = false;
            checkBox5.Checked = false;
            checkBox6.Checked = false;

            radioButton1.Checked = false;
            radioButton2.Checked = false;
            radioButton3.Checked = false;
            radioButton4.Checked = false;
            radioButton5.Checked = false;
            radioButton6.Checked = false;
            radioButton7.Checked = false;
            radioButton8.Checked = false;

            comboBox1.Text = "";
            comboBox2.Text = "";
            comboBox3.Text = "";

            numericUpDown1.Text = "";
            numericUpDown2.Text = "";

            button2.Enabled = false;
            button3.Enabled = false;
            button4.Enabled = false;

            listBox1.Items.Clear();
            textBox1.Enabled = false;
            textBox2.Enabled = false;
            textBox3.Enabled = false;
            textBox4.Enabled = false;
            textBox5.Enabled = false;
            textBox6.Enabled = false;

            checkBox1.Enabled = false;
            checkBox2.Enabled = false;
            checkBox3.Enabled = false;
            checkBox4.Enabled = false;
            checkBox5.Enabled = false;
            checkBox6.Enabled = false;

            radioButton1.Enabled = false;
            radioButton2.Enabled = false;
            radioButton3.Enabled = false;
            radioButton4.Enabled = false;
            radioButton5.Enabled = false;
            radioButton6.Enabled = false;
            radioButton7.Enabled = false;
            radioButton8.Enabled = false;

            comboBox1.Enabled = false;
            comboBox2.Enabled = false;
            comboBox3.Enabled = false;

            numericUpDown1.Enabled = false;
            numericUpDown2.Enabled = false;

            button2.Enabled = false;
            button3.Enabled = false;
            button4.Enabled = false;

        }

        private void button4_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Yakin?", "warning", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                Close();
            }
            else
            {

            }
        }

        private void groupBox4_Enter(object sender, EventArgs e)
        {

        }
    }
}
 

Tidak ada komentar: