1








Class Form1
Variabel Komponen
Event
Source Code
Form 1
Load
private void Form1_Load(object sender, EventArgs e)
{ clbProdi.Items.Add("S-1 Matematika");
  clbProdi.Items.Add("S-1 Biologi");
  clbProdi.Items.Add("S-1 Kimia");
  clbProdi.Items.Add("S-1 Fisika");
  clbProdi.Items.Add("S-1 Farmasi");
  clbProdi.Items.Add("S-1 Ilmu Komputer");
  clbProdi.Items.Add("D-3 Analis Farmasi dan Makanan");     }
cbTgl
KeyPress
private void cbTgl_KeyPress(object sender, KeyPressEventArgs e)
{ char ch = e.KeyChar;
  if (!Char.IsDigit(ch) && ch != 8)
  { MessageBox.Show("Hanya angka", "Peringatan", MessageBoxButtons.OK, MessageBoxIcon.Warning);
    e.Handled = true;
  }
}
cbBln
KeyPress
private void cbBln_KeyPress(object sender, KeyPressEventArgs e)
{ char ch = e.KeyChar;
  if (!Char.IsDigit(ch) && ch != 8)
  { MessageBox.Show("Hanya angka", "Peringatan", MessageBoxButtons.OK, MessageBoxIcon.Warning);
   e.Handled = true;
  }
}
cbThn
KeyPress
private void cbThn_KeyPress(object sender, KeyPressEventArgs e)
{ char ch = e.KeyChar;
  if (!Char.IsDigit(ch) && ch != 8)
  { MessageBox.Show("Hanya angka", "Peringatan",MessageBoxButtons.OK, MessageBoxIcon.Warning);
  e.Handled = true;
  }
}
btnSend
Click
private void btnSend_Click(object sender, EventArgs e)
{ bool centang = true;
  if (txtNama.Text == "" || txtTlahir.Text == "" || txtSekolah.Text == "" || cbTgl.Text == "" || cbBln.Text == "" || cbThn.Text == "" || clbProdi.Text == "")
    MessageBox.Show("Field Teks masih kosong harap diisi", "Peringatan", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  else
   if (rbLk.Checked == false && rbPr.Checked == false)
    MessageBox.Show("Jenis Kelamin belum dipilih", "Peringatan", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  else
  { DialogResult result;
    string judul = "Confimation";
    string a, b, c, d, f, g, h, i;
    if (rbLk.Checked == true) i = "Laki - Laki";
    else i = "Perempuan";
    a = "\n\n" + "Nama" + "\t\t" + ": " + txtNama.Text;
    b = "\n" + "Jenis Kelamin" + "\t" + ": " + i;
    c = "\n" + "Tempat Lahir" + "\t" + ": " + txtTlahir.Text;
    d = "\n" + "Tanggal Lahir" + "\t" + ": " + cbTgl.Text + "-" + cbBln.Text + "-" + cbThn.Text;
    f = "\n" + "Asal Sekolah" + "\t" + ": " + txtSekolah.Text;
    g = "\n" + "Pilihan Prodi" + "\t" + ": " + clbProdi.SelectedItem;
 
string pesan = "Mohon Periksa Kembali Data Anda di bawah ini :" + a + b + c + d + f + g + "\n\n" + "Apakah Data Anda Sudah Benar ??" + "\n" + "Lanjutkan?";
MessageBoxButtons pil_tombol = MessageBoxButtons.YesNo;
result = MessageBox.Show(pesan, judul, pil_tombol, MessageBoxIcon.Warning);
if (result == DialogResult.Yes)
{ judul = "Congratulation !!";
  pesan = "Pendaftaran Anda Berhasil"+"\n"+"Terima Kasih :)";
  result = MessageBox.Show(pesan, judul, MessageBoxButtons.OK,        MessageBoxIcon.Information);
   if(result == DialogResult.OK)
   { Application.Exit(); }                   
  }
 };
}
btnExit
Click
private void btnExit_Click_1(object sender, EventArgs e)
{ DialogResult result;
  string judul = "Confirmation";
  string pesan = "Apakah Anda yakin ingin keluar?";
  MessageBoxButtons pil_tombol = MessageBoxButtons.YesNo;
  result = MessageBox.Show(pesan, judul, pil_tombol,MessageBoxIcon.Warning);
  if (result == DialogResult.Yes)
  { Application.Exit(); }       
}



Posting Komentar

  1. ini ga make database ya , kalo biar digabung sama database gimana ya??

    BalasHapus

 
Top