private void edit() { try { STStats data = GetSelectionData(); if (data.idplayer > 0) { DlgStats wnd = new DlgStats(connect, mode, data, lst_records); DialogResult result = wnd.ShowDialog(); if (result == DialogResult.OK) { flawour = wnd.GetFl(); init_data(); if (gpos >= 0 && dataGridViewStats.Rows.Count > 0) { dataGridViewStats.Rows[gpos].Selected = true; // dataGridViewStats.FirstDisplayedScrollingRowIndex = gpos; } if (wnd.GetRec()) { init_records(); } } } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void buttonAdd_Click(object sender, EventArgs e) { STEntryPlayers tc = new STEntryPlayers(); try { if (comboBoxPlayers.Text.Length > 0) { string text = comboBoxPlayers.Text.Trim(); char[] del = { '#', ' ' }; string[] words = text.Split(del); string number = words[1]; string famili = words[2]; string name = words[3]; foreach (STEntryPlayers item in currteam) { CPlayer clp = new CPlayer(connect, item.idplayer); if (number.Equals(item.number) && famili.Equals(clp.stPlayer.family) && name.Equals(clp.stPlayer.name)) { tc = item; } } DlgStats wnd = new DlgStats(connect, mode, tc.idseason, gSTGame.idgame, tc.idteam, tc.idplayer, tc.number, lst_records); if (wnd.ShowDialog() == DialogResult.OK) { flawour = wnd.GetFl(); init_data(); if (gpos >= 0 && dataGridViewStats.Rows.Count > 0) { dataGridViewStats.Rows[gpos].Selected = true; // dataGridViewStats.FirstDisplayedScrollingRowIndex = gpos; } if (wnd.GetRec()) { init_records(); } } } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }