public void TampilSemuaSoal() { bacaData soal = new bacaData(); tabel = soal.bacaSemuaSoal(); tampilSoal.DataSource = null; tampilSoal.Columns.Clear(); tampilSoal.DataSource = tabel; tampilSoal.AllowUserToAddRows = false; tampilSoal.ReadOnly = true; tampilSoal.Columns[0].Visible = false; tampilSoal.Columns[1].Visible = false; tampilSoal.Columns[2].Visible = false; tampilSoal.Columns[3].HeaderText = "No Soal"; tampilSoal.Columns[3].Width = 110; tampilSoal.Columns[4].HeaderText = "Mata Pelajaran"; tampilSoal.Columns[4].Width = 220; tampilSoal.Columns[5].HeaderText = "Kategori Soal"; tampilSoal.Columns[5].Width = 220; tampilSoal.Columns[6].Visible = false; ikutiTes = new DataGridViewButtonColumn(); ikutiTes.HeaderText = "Ikuti Tes Soal"; ikutiTes.UseColumnTextForButtonValue = true; ikutiTes.Text = "Ikut Tes"; tampilSoal.Columns.Add(ikutiTes); }
public void MataPelajaran() { bacaData pelajaran = new bacaData(); tabel = pelajaran.bacaKategoriMataPelajaran(); foreach (DataRow kolom in tabel.Rows) { string id = kolom["id_pel"].ToString(); string nm_kat = kolom["nama_pel"].ToString(); string gbng = "" + id + "-" + nm_kat + ""; cmbMataPelajaran.Items.Add(gbng); cmbMataPelajaran2.Items.Add(gbng); } }
public void KategoriSoal() { bacaData kategori = new bacaData(); tabel = kategori.bacaKategoriSoal(); foreach (DataRow kolom in tabel.Rows) { string id = kolom["id_kat"].ToString(); string nm_kat = kolom["nama_kat"].ToString(); string gbng = "" + id + "-" + nm_kat + ""; cmbKategori.Items.Add(gbng); cmbKategori2.Items.Add(gbng); } }
void Button1Click(object sender, EventArgs e) { if (cmbKategori.Text == "") { MessageBox.Show("Uppzz, error cuy...!!!"); } else { string id = cmbKategori.Text.Substring(0, 1); if (id.Length >= 2) { id = cmbKategori.Text.Substring(0, 2); } bacaData soal = new bacaData(); tabel = soal.bacaSoalPerKategori(id); TampilSoalBy(tabel); } }