Untitled
unknown
csharp
4 years ago
1.1 kB
17
Indexable
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Entity;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp4
{
public partial class Form1 : Form
{
EmpSystemManagerEntities db;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
db = new EmpSystemManagerEntities();
db.Employees.Load();
employeesBindingSource.DataSource = db.Employees.Local;
}
private void button1_Click(object sender, EventArgs e)
{
if (nom_et_PrénomTextBox.Text != String.Empty)
{
employeesBindingSource.AddNew();
db.SaveChanges();
}
else
{
MessageBox.Show("please make sure to enter the user name", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
Editor is loading...