//edit a runners data private void RunnerTableDoubleClick(object sender, DataGridViewCellEventArgs e) { var row = dataGridRunners.Rows[e.RowIndex]; string info = ""; string firstName = ""; string lastName = ""; DateTime dob = DateTime.MinValue; string bibId = ""; string team = ""; string org = ""; char sex = 'N'; foreach (DataGridViewTextBoxCell data in row.Cells) { switch (dataGridRunners.Columns[data.ColumnIndex].Name) { case "FirstName": firstName = dataGridRunners[data.ColumnIndex, data.RowIndex].Value.ToString(); break; case "LastName": lastName = dataGridRunners[data.ColumnIndex, data.RowIndex].Value.ToString(); break; case "BibID": bibId = dataGridRunners[data.ColumnIndex, data.RowIndex].Value.ToString(); break; case "DOB": var parts = dataGridRunners[data.ColumnIndex, data.RowIndex].Value.ToString().Split('-'); dob = new DateTime(Int32.Parse(parts[0]), Int32.Parse(parts[1]), Int32.Parse(parts[2])); break; case "Team": team = dataGridRunners[data.ColumnIndex, data.RowIndex].Value.ToString(); break; case "Orginization": org = dataGridRunners[data.ColumnIndex, data.RowIndex].Value.ToString(); break; case "Gender": sex = dataGridRunners[data.ColumnIndex, data.RowIndex].Value.ToString().ToUpper().ToCharArray()[0]; break; default: break; } } var person = new NewUserWindow(raceData, this, firstName, lastName, dob, bibId, sex, team, org); person.Show(); }
//edit a runners data private void RunnerTableDoubleClick(object sender, DataGridViewCellEventArgs e) { var row=dataGridRunners.Rows[e.RowIndex]; string info = ""; string firstName = ""; string lastName = ""; DateTime dob = DateTime.MinValue; string bibId = ""; string team = ""; string org = ""; char sex='N'; foreach (DataGridViewTextBoxCell data in row.Cells) { switch (dataGridRunners.Columns[data.ColumnIndex].Name) { case "FirstName": firstName = dataGridRunners[data.ColumnIndex, data.RowIndex].Value.ToString(); break; case "LastName": lastName = dataGridRunners[data.ColumnIndex, data.RowIndex].Value.ToString(); break; case "BibID": bibId = dataGridRunners[data.ColumnIndex, data.RowIndex].Value.ToString(); break; case "DOB": var parts = dataGridRunners[data.ColumnIndex, data.RowIndex].Value.ToString().Split('-'); dob = new DateTime(Int32.Parse(parts[0]), Int32.Parse(parts[1]), Int32.Parse(parts[2])); break; case "Team": team = dataGridRunners[data.ColumnIndex, data.RowIndex].Value.ToString(); break; case "Orginization": org = dataGridRunners[data.ColumnIndex, data.RowIndex].Value.ToString(); break; case "Gender": sex = dataGridRunners[data.ColumnIndex, data.RowIndex].Value.ToString().ToUpper().ToCharArray()[0]; break; default: break; } } var person = new NewUserWindow(raceData, this, firstName, lastName, dob, bibId, sex, team, org); person.Show(); }
//adding user button private void BtnAddRunner_Click(object sender, EventArgs e) { var user = new NewUserWindow(raceData, this); user.Show(); }