i need solution for repeat items in DataGridView
i design form for Patients , i try to show Patient List in dataGridView
But when i closed form and open DataGridView For Patient Again , Patient List is repeating
for Example
i have 10 row for Patients in database
when i open form DataGridView show 10 row
But when i closed form and open DataGridView For Patient Again datagridview
show 10 row and repeat the same row again
What I have tried:
class to get data from database
public static class Show_Patients_In_DataGridView
{
static DXL.DXL ob = new DXL.DXL();
public static DataTable View_Patient_Data()
{
DataTable dt = new DataTable();
ob.open();
dt = ob.Reader("View_All_Patients", null);
ob.close();
return dt;
}
}
public partial class Patient_Management : Form
{
public Patient_Management()
{
InitializeComponent();
DGV.DataSource = Show_Patients_In_DataGridView.View_Patient_Data();
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
DGV.DataSource = null;
}
private void DGV_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
DGV.DataSource = Show_Patients_In_DataGridView.View_Patient_Data();
}
}