0



A.      Coding Program
Variabel Komponen
Source Code
frmID
private void frmID_Load(object sender, EventArgs e)
{ cmbAgama.Items.Add("Islam");
  cmbAgama.Items.Add("Kristen");
  cmbAgama.Items.Add("Katolik");
  cmbAgama.Items.Add("Budha");
  cmbAgama.Items.Add("Hindu");
}
//pada bagian ini diberikan beberapa source code untuk mengisi Items Collection secara manual pada ComboBox melalui konponen frmID dengan mengunakan Event Load.
btnProses
private void btnProses_Click(object sender, EventArgs e)
{ string a, b, c;
  a = "Nama : " + txtNama.Text;
  if (optLaki.Checked == true)
  { a = "Nama" + "\t" + "\t" + ":" + "  " + txtNama.Text + "\n" + " Jenis Kelamin" + "\t" + ":" + "  " + "Laki - Laki";
   }
   else
   { a = "Nama" + "\t" + "\t" + ":" + "  " + txtNama.Text + "\n" + " Jenis Kelamin" + "\t" + ":" + "  " + "Perempuan";
    }

    b = a;
    if(cmbAgama.SelectedItem.ToString() == "Islam")
    { b = a + "\n Agama" + "\t" + "\t" + ":" + "  " + "Islam";
    }
    else
    if(cmbAgama.SelectedItem.ToString()
== "Kristen")
    { b = a + "\n Agama" + "\t" + "\t" + ":" + "  " + "Kristen";
    }
    else
    if(cmbAgama.SelectedItem.ToString()
== "Khatolik")
    { b = a + "\n Agama" + "\t" + "\t" + ":" + "  " + "Khatolik";
    }
    else
    if(cmbAgama.SelectedItem.ToString()
== "Hindu")
    { b = a + "\n Agama" + "\t" + "\t" + ":" + "  " + "Hindu";
    }
    else
     { b = a + "\n Agama" + "\t" + "\t" + ":" + "  " + "Budha";
     }

     c = b;           
     if (chkMembaca.Checked == true)
     { c = b + "\n hoby" + "\t" + "\t" + ":" + "  " + "Membaca";
     }
     if (chkMenyanyi.Checked == true)
     { c = b + "\n hoby" + "\t" + "\t" + ":" + "  " + "Menyanyi";
     }
     if (chkOlahraga.Checked == true)
     { c = b + "\n hoby" + "\t" + "\t" + ":" + "  " + "Olah Raga";
     }

     if (chkMembaca.Checked && chkMenyanyi.Checked == true)
     { c = b + "\n hoby" + "\t" + "\t" + ":" + "  " + "Membaca" + "\n" + "\t" + "\t" + "   " + "Menyanyi";
     }
     if (chkMembaca.Checked && chkOlahraga.Checked == true)
     { c = b + "\n hoby" + "\t" + "\t" + ":" + "  " + "Membaca" + "\n" + "\t" + "\t" + "   " + "Olah Raga";
     }
     if (chkMenyanyi.Checked && chkOlahraga.Checked == true)
     { c = b + "\n hoby" + "\t" + "\t" + ":" + "  " + "Menyanyi" + "\n" + "\t" + "\t" + "   " + "Olah Raga";
       }
      
       if (chkMenyanyi.Checked && chkMembaca.Checked && chkOlahraga.Checked == true)
       { c = b + "\n hoby" + "\t" + "\t" + ":" + "  " + "Membaca" + "\n" + "\t" + "\t" + "   " + "Menyanyi" + "\n" + "\t" + "\t" + "  " + "Olahraga";
       }
       else
       {
       }
MessageBox.Show("Data Diri  \n \n " + c.ToString() , "Biodata Diri Anda");
//pada bagian ini menggunkan statement percabangan IF dan juga menggunakan operator “+” sebagai penghubung karakter bertipe data string.    




Posting Komentar

 
Top