private void comboBoxSession_SelectedIndexChanged(object sender, EventArgs e) { if (comboBoxSession.SelectedItem == null) { return; } DataRowView drv = comboBoxSession.SelectedItem as DataRowView; String str = drv.Row["session_name"].ToString(); Int32 id = (int)drv.Row["session_id"]; DataRow[] games = schedule.session_games.Select("session_id=" + id.ToString()); //schedule.SetCurrentSession( row ); // List<object[]> game_list = new List<object[]>(); // ApplyValues(); dataGridViewGames.Rows.Clear(); //DataRow[] games0 = schedule.sessions.Games( current_session ); //DataRow[] games = schedule.session_macro_sessions.GetGames( current_session ); game_config.Fill(); //foreach( DataRowView game_view in schedule_currents.current_session_games ) foreach (DataRow game in games) //for( int x = 0; x < games.Length; x++ ) { //DataRow game = game_view.Row; object key; object[] newrow = new object[4]; //newrow[0] = game[XDataTable.Name(game.Table)]; newrow[0] = game.ToString(); key = newrow[2] = game[SessionGame.PrimaryKey]; DataRow[] rate_conf_row = game_config.Select(SessionGame.PrimaryKey + "=" + key.ToString()); if (rate_conf_row.Length > 0) { newrow[1] = newrow[3] = rate_conf_row[0]["rate"]; } else { DataRow new_conf_row = game_config.NewRow(); new_conf_row["rate"] = true; new_conf_row[SessionGame.PrimaryKey] = game[SessionGame.PrimaryKey]; game_config.Rows.Add(new_conf_row); game_config.CommitChanges(); newrow[1] = newrow[3] = true; } dataGridViewGames.Rows.Add(newrow); } }