private void CellClicked(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            if (e.ColumnIndex == 1)
            {
                ResearchDatabaseDataSet.ApplicationGenreRelationRow boundItem = (ResearchDatabaseDataSet.ApplicationGenreRelationRow)((DataRowView)MainGridView.Rows[e.RowIndex].DataBoundItem).Row;

                if (boundItem.Selected == 1)
                {
                    boundItem.Selected = 0;
                }
                else
                {
                    boundItem.Selected = 1;
                }

                DataGridViewCellEventArgs e2 = new DataGridViewCellEventArgs(0, e.RowIndex);

                ValueChanged(sender, e2);
            }
        }
        private void ValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0 && e.ColumnIndex == 0) // Selected Changed
            {
                if (m_kType == GenreAndMechanicsType.GenreType)
                {
                    ResearchDatabaseDataSet.ApplicationGenreRelationRow boundItem = (ResearchDatabaseDataSet.ApplicationGenreRelationRow)((DataRowView)MainGridView.Rows[e.RowIndex].DataBoundItem).Row;
                    ResearchDatabaseDataSet.ApplicationGenreDataTable   lk_tab    = new ResearchDatabaseDataSet.ApplicationGenreDataTable();
                    ResearchDatabaseDataSetTableAdapters.ApplicationGenreTableAdapter lk_adapt = new ResearchDatabaseDataSetTableAdapters.ApplicationGenreTableAdapter();
                    lk_adapt.Fill(lk_tab);

                    if (boundItem.Selected == 1)
                    {
                        lk_adapt.Insert(ApplicationId, boundItem.GenreId);
                    }
                    else
                    {
                        lk_adapt.Delete(ApplicationId, boundItem.GenreId);
                    }

                    lk_tab.AcceptChanges();

                    lk_adapt.Update(researchDatabaseDataSet);
                }
                else
                {
                    ResearchDatabaseDataSet.ApplicationMechanicRelationRow boundItem = (ResearchDatabaseDataSet.ApplicationMechanicRelationRow)((DataRowView)MainGridView.Rows[e.RowIndex].DataBoundItem).Row;
                    ResearchDatabaseDataSet.ApplicationMechanicDataTable   lk_tab    = new ResearchDatabaseDataSet.ApplicationMechanicDataTable();
                    ResearchDatabaseDataSetTableAdapters.ApplicationMechanicTableAdapter lk_adapt = new ResearchDatabaseDataSetTableAdapters.ApplicationMechanicTableAdapter();
                    lk_adapt.Fill(lk_tab);

                    if (boundItem.Selected == 1)
                    {
                        lk_adapt.Insert(ApplicationId, boundItem.Id);
                    }
                    else
                    {
                        lk_adapt.Delete(ApplicationId, boundItem.Id);
                    }

                    lk_adapt.Update(researchDatabaseDataSet);
                }

                researchDatabaseDataSet.AcceptChanges();
            }
        }