private void textBox7_TextChanged(object sender, EventArgs e)
 {
     try
     {
         using (ProjectLINQDataContext pl = new ProjectLINQDataContext())
         {
             dataGridView1.AutoGenerateColumns         = false;
             dataGridView1.ColumnCount                 = 3;
             dataGridView1.Columns[0].HeaderText       = "Criminal ID";
             dataGridView1.Columns[0].DataPropertyName = "Criminal_ID";
             dataGridView1.Columns[1].HeaderText       = "Crime Type";
             dataGridView1.Columns[1].DataPropertyName = "Crime";
             //dataGridView1.Columns[2].HeaderText = "Age";
             //dataGridView1.Columns[2].DataPropertyName = "Age";
             dataGridView1.Columns[2].HeaderText       = "Year";
             dataGridView1.Columns[2].DataPropertyName = "Year";
             dataGridView1.DataSource = data.CrimeInfos.Where(x => x.Criminal_ID.ToString().Contains(textBox7.Text)).ToList();
             // dataGridView1.DataSource = pl.CrimeInfos;
         }
     }
     catch (Exception ee)
     {
         //MessageBox.Show(ee.Message);
     }
 }
        private void button3_Click(object sender, EventArgs e)
        {
            //dataGridView1.Refresh();
            ProjectLINQDataContext pl2 = new ProjectLINQDataContext();
            Criminal_Info          cif = pl2.Criminal_Infos.SingleOrDefault(Criminal_Info => Criminal_Info.Criminal_ID == int.Parse(textBox2.Text));

            try
            {
                if (pl2 != null)
                {
                    pl2.Criminal_Infos.DeleteOnSubmit(cif);
                    pl2.SubmitChanges();
                    MessageBox.Show("Deleted Successfully");
                    dataGridView1.DataSource = pl2.Criminal_Infos;
                    dataGridView1.Refresh();
                    textBox2.Text  = null;
                    textBox3.Text  = null;
                    textBox4.Text  = null;
                    comboBox1.Text = null;
                    textBox6.Text  = null;
                    textBox7.Text  = null;
                }
                else
                {
                    MessageBox.Show("Data not found");
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            ProjectLINQDataContext pl     = new ProjectLINQDataContext();
            DataGridViewRow        newrow = dataGridView1.Rows[indexRow];
            Criminal_Info          ci     = pl.Criminal_Infos.Single(Criminal_Info => Criminal_Info.Criminal_ID == int.Parse(textBox2.Text));

            try
            {
                if (ci != null)
                {
                    ci.Name        = textBox3.Text;
                    ci.DOB         = textBox4.Text;
                    ci.Blood_Group = comboBox1.Text;
                    ci.Birth_Place = textBox7.Text;
                    ci.NID_No_     = int.Parse(textBox6.Text);
                    pl.SubmitChanges();
                    newrow.Cells[1].Value = textBox3.Text;
                    newrow.Cells[1].Value = textBox3.Text;
                    newrow.Cells[3].Value = textBox4.Text;
                    newrow.Cells[4].Value = comboBox1.Text;
                    newrow.Cells[5].Value = textBox7.Text;
                    newrow.Cells[6].Value = textBox6.Text;
                    MessageBox.Show("Profile Successfully Updated !");
                    textBox2.Text  = null;
                    textBox3.Text  = null;
                    textBox4.Text  = null;
                    comboBox1.Text = null;
                    textBox6.Text  = null;
                    textBox7.Text  = null;
                }

                else
                {
                    MessageBox.Show("Data Not found");
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
 private void Matched_Criminal_History_Form_Load(object sender, EventArgs e)
 {
     try {
         using (ProjectLINQDataContext pl = new ProjectLINQDataContext())
         {
             dataGridView1.AutoGenerateColumns         = false;
             dataGridView1.ColumnCount                 = 3;
             dataGridView1.Columns[0].HeaderText       = "Criminal ID";
             dataGridView1.Columns[0].DataPropertyName = "Criminal_ID";
             dataGridView1.Columns[1].HeaderText       = "Crime Type";
             dataGridView1.Columns[1].DataPropertyName = "Crime";
             //dataGridView1.Columns[2].HeaderText = "Age";
             //dataGridView1.Columns[2].DataPropertyName = "Age";
             dataGridView1.Columns[2].HeaderText       = "Year";
             dataGridView1.Columns[2].DataPropertyName = "Year";
             dataGridView1.DataSource = pl.CrimeInfos;
         }
     }
     catch (Exception ee)
     {
         //MessageBox.Show(ee.Message);
     }
 }