0
当我双击DataGridViewRow时,打开MDI子项。在MDI子项中显示了所选行的值。其中一个值显示在组合框中。当我打开第一个MDI小孩一切顺利,组合框显示正确的值(正确的控制台)。打开相同MDI子项时,组合框值发生变化
但是,当我打开一个类似的第二个MDI子项从DataGridView中选择另一行时,第一个MDI子项中的组合框值更改为必须在第二个MDI子项中显示的值。第一个MDI子窗体中的所有其他textboxvalue仍然正确显示。
有没有人有这个问题的解决方案?
MDI父窗体
private void dataGridViewGames_DoubleClick(object sender, EventArgs e)
{
FormGame formGame = new FormGame();
formGame.MdiParent = this.MdiParent;
formGame.Name = dataGridViewGames.SelectedRows[0].Index.ToString();
formGame.Rij = dataGridViewGames.SelectedRows[0].Index;
formGame.Consoles = consoles;
formGame.Games = games;
formGame.Show();
formGame.LeesGame();
}
MDI子窗体
private void FormGame_Load(object sender, EventArgs e)
{
comboBoxConsole.DataSource = consoles;
comboBoxConsole.DisplayMember = "Naam";
comboBoxConsole.ValueMember = "Id";
}
public void LeesGame()
{
DBGames.GameRow gameRij = (DBGames.GameRow)games.Rows[rij];
this.Text = "Game - " + gameRij.Naam;
textBoxNaam.Text = gameRij.Naam;
textBoxPrijs.Text = gameRij.Prijs.ToString();
textBoxAfbeelding.Text = gameRij.Afbeelding;
comboBoxConsole.SelectedValue = gameRij.ConsoleId;
}
谢谢,问题解决了! – JochenDB