Пример #1
0
        private void countriesTable_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            DataTable DT = this.countriesTable.DataSource as DataTable;

            if (DT != null)
            {
                DataRow DR = null;
                try
                {
                    DR = ((DataRowView)this.countriesTable.SelectedRows[0].DataBoundItem).Row;
                }
                catch (Exception) { return; }
                if (DR != null)
                {
                    try
                    {
                        DataRow[] DRS = DR.GetChildRows(this.DS.Relations["CityCountryRelation"]);
                        ((DataTable)this.citiesTable.DataSource).Rows.Clear();
                        foreach (DataRow r in DRS)
                        {
                            ((DataTable)this.citiesTable.DataSource).Rows.Add(r.ItemArray);
                        }
                    }
                    catch (Exception a) { MessageBox.Show(a.Message); }
                }
            }
        }