Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

Patulong! C# Add Edit Delete Database

0425Benciel

Novice
Advanced Member
Messages
44
Reaction score
0
Points
26
PATULONG PO!
Pasensya na dahil di pa ako marunong sa C#. Sana po matulungan nyo ako

View attachment 324393
View attachment 324394

using System;
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 Barangay_Management_System
{
public partial class residentRegForm : Form
{
public residentRegForm()
{
InitializeComponent();
}

private void residentRegForm_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'appdata.Resident_Registration' table. You can move, or remove it, as needed.
this.resident_RegistrationTableAdapter.Fill(this.appdata.Resident_Registration);
residentRegistrationBindingSource.DataSource = this.appdata.Resident_Registration;
}

private void btnBack1_Click(object sender, EventArgs e)
{
mainForm f1 = new mainForm();
f1.Show();
this.Hide();
}

private void btnAdd1_Click(object sender, EventArgs e)
{
try
{
residentRegistrationBindingSource.EndEdit();
resident_RegistrationTableAdapter.Update(this.appdata.Resident_Registration);
panel.Enabled = false;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
residentRegistrationBindingSource.ResetBindings(false);
}
}

private void btnNew1_Click(object sender, EventArgs e)
{
try
{
panel.Enabled = true;
txtboxRegID.Focus();
this.appdata.Resident_Registration.AddResident_RegistrationRow(this.appdata.NewResident_RegistrationRow());
residentRegistrationBindingSource.MoveLast();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
residentRegistrationBindingSource.ResetBindings(false);
}
}

private void btnDelete1_Click(object sender, EventArgs e)
{
panel.Enabled = false;
residentRegistrationBindingSource.ResetBindings(false);

}

private void btnEdit_Click(object sender, EventArgs e)
{
panel.Enabled = true;
txtboxRegID.Focus();
}

private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{

}

private void dataGridView1_Keydown(object sender, KeyEventArgs e)
{
if(e.KeyCode == Keys.Delete)
{
if (MessageBox.Show("Delete this record?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
residentRegistrationBindingSource.RemoveCurrent();
}
}

private void txtboxSearch_TextChanged(object sender, EventArgs e)
{

}

private void txtboxSearch_Keypress(object sender, KeyPressEventArgs e)
{
}
}
}
 

Attachments

  • 1.png
    1.png
    180.7 KB · Views: 31
  • 2.png
    2.png
    162.4 KB · Views: 23
Last edited:
Back
Top Bottom