private void TambahData() { try { if (tbNama.Text != "" && gender != "" && tbUmur.Text != "") { using (var db = new DaftarUser()) { user = new User { Nama = tbNama.Text, Jenis_Kelamin = gender, Umur = tbUmur.Text, }; db.Users.Add(user); db.SaveChanges(); } MessageBox.Show("Hai " + _namaUser + "! Selamat Datang!"); mainMenu formMenu = new mainMenu(); var result = formMenu.ShowDialog(); } else { MessageBox.Show("Nama, Jenis Kelamin, dan Umur Anda harus diisi !"); } } catch (Exception e) { MessageBox.Show(e.Message, "Format Nama dan Umur harus benar!"); } }
private void btnBackmenu_Click(object sender, EventArgs e) { this.Hide(); mainMenu mainmenu = new mainMenu(); DialogResult results = mainmenu.ShowDialog(); }