code2pdf_67294b4b2b839
code2pdf_67294b4b2b839
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Tugas2_FahmirizalBudiRamadhan
{
public partial class FAnggota : Form
{
public FAnggota()
{
InitializeComponent();
}
int norut = 0;
string kondisi = "simpan";
int lokasi_ubah;
dataGridView1.Rows.Add("" + norut, "" + txt_nama.Text, "" + txt_email.Text, "" + txt_alamat.Text, "" + txt_user.Text, "" + txt_pass.Text, "Anggota"
}
else if (kondisi == "ubah")
{
dataGridView1.Rows[lokasi_ubah].Cells[1].Value = txt_nama.Text;
dataGridView1.Rows[lokasi_ubah].Cells[2].Value = txt_email.Text;
dataGridView1.Rows[lokasi_ubah].Cells[3].Value = txt_alamat.Text;
dataGridView1.Rows[lokasi_ubah].Cells[4].Value = txt_user.Text;
dataGridView1.Rows[lokasi_ubah].Cells[5].Value = txt_pass.Text;
DialogInfo DI = new DialogInfo("Success", "Data Berhasil Diedit !", Properties.Resources.Ok_32px, Color.FromArgb(57, 155, 53));
DI.ShowDialog();
kondisi = "simpan";
}
bersih(this);
dataGridView1.ClearSelection();
}
if (idx_kolom == 7)
{
dialogtanya DT = new dialogtanya("Are You Sure ?", "Do you really want edit this data? You will be able to undo this action.");
DialogResult setuju = DT.ShowDialog();
if (setuju == DialogResult.Yes)
{
lokasi_ubah = idx_baris;
kondisi = "ubah";
string nama = dataGridView1.Rows[idx_baris].Cells[1].Value.ToString();
string email = dataGridView1.Rows[idx_baris].Cells[2].Value.ToString();
string alamat = dataGridView1.Rows[idx_baris].Cells[3].Value.ToString();
string user = dataGridView1.Rows[idx_baris].Cells[4].Value.ToString();
string pass = dataGridView1.Rows[idx_baris].Cells[5].Value.ToString();
txt_nama.Text = nama;
txt_email.Text = email;
txt_alamat.Text = alamat;
txt_user.Text = user;
txt_pass.Text = pass;
}
else if (idx_kolom == 8)
{
dialogtanya DT = new dialogtanya("Are You Sure ?", "Do you really want delete this data? You will not be able to undo this action.");
DialogResult setuju = DT.ShowDialog();
if (setuju == DialogResult.Yes)
{
dataGridView1.Rows.RemoveAt(idx_baris);
DialogInfo DI = new DialogInfo("Success", "Data Berhasil Dihapus !", Properties.Resources.Ok_32px, Color.FromArgb(57, 155, 53));
DI.ShowDialog();
}
}
}
if (namaagt == cari)
{
adagak = "ada";
lokasi_ubah = i;
kondisi = "ubah";
string nama = dataGridView1.Rows[i].Cells[1].Value.ToString();
string email = dataGridView1.Rows[i].Cells[2].Value.ToString();
string alamat = dataGridView1.Rows[i].Cells[3].Value.ToString();
string user = dataGridView1.Rows[i].Cells[4].Value.ToString();
string pass = dataGridView1.Rows[i].Cells[5].Value.ToString();
txt_nama.Text = nama;
txt_email.Text = email;
txt_alamat.Text = alamat;
txt_user.Text = user;
txt_pass.Text = pass;
}
}
if (adagak == "ga")
{
System.Media.SoundPlayer player = new System.Media.SoundPlayer(Properties.Resources.awas);
player.Play();
DialogInfo DI = new DialogInfo("Peringatan", "Data Tidak Ditemukan !", Properties.Resources.Attention_32px, Color.FromArgb(255, 202, 40));
DI.ShowDialog();
}
}