private void dataGridMatches_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (dataGridMatches.Columns[e.ColumnIndex].Name == "Markets") { if (!e.RowIndex.ToString().Equals("-1")) { string id = Convert.ToString(dataGridMatches.Rows[e.RowIndex].Cells[5].Value); string team1 = Convert.ToString(dataGridMatches.Rows[e.RowIndex].Cells[2].Value); team1 = team1.Substring(0, team1.IndexOf('(')); string team2 = Convert.ToString(dataGridMatches.Rows[e.RowIndex].Cells[4].Value); team2 = team2.Substring(0, team2.IndexOf('(')); string matchday = Convert.ToString(dataGridMatches.Rows[e.RowIndex].Cells[0].Value); string time = Convert.ToString(dataGridMatches.Rows[e.RowIndex].Cells[1].Value); Form childForm = new BettingMarkets(Convert.ToInt64(id), team1 + " VS " + team2 + "\n" + matchday + " " + time); childForm.MdiParent = this.ParentForm; //childForm.Text = "Window " + childFormNumber++; childForm.Show(); //MessageBox.Show(id); } } } catch (Exception ex) { } }
private void dataGridMatches_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (dataGridMatches.Columns[e.ColumnIndex].Name == "Markets") { if (!e.RowIndex.ToString().Equals("-1")) { string id = Convert.ToString(dataGridMatches.Rows[e.RowIndex].Cells[5].Value); string team1 = Convert.ToString(dataGridMatches.Rows[e.RowIndex].Cells[2].Value); team1 = team1.Substring(0, team1.IndexOf('(')); string team2 = Convert.ToString(dataGridMatches.Rows[e.RowIndex].Cells[4].Value); team2 = team2.Substring(0, team2.IndexOf('(')); string matchday = Convert.ToString(dataGridMatches.Rows[e.RowIndex].Cells[0].Value); string time = Convert.ToString(dataGridMatches.Rows[e.RowIndex].Cells[1].Value); Form childForm = new BettingMarkets(Convert.ToInt64(id), team1 + " VS " + team2 + "\n" + matchday + " " + time); childForm.MdiParent = this.ParentForm; //childForm.Text = "Window " + childFormNumber++; childForm.Show(); //MessageBox.Show(id); } } } catch (Exception ex) { } }