- 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)
{
}
}
}
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
Last edited: