private void EditRace_load(object sender, EventArgs e) { txtRaceid.Text = race.ID.ToString(); if (race.GetType() == typeof(Race)) { txtRaceid.Text = race.ID.ToString(); timeDatePicker.Text = race.Date.ToString(); txtTime.Text = race.StartTime.ToString(); txtLocation.Text = race.Location.ToString(); txtCapacity.Text = race.Capacity.ToString(); txtCosttt.Text = race.Cost.ToString(); } else if (race.GetType() == typeof(MotorRace)) { MotorRace motorRace = (MotorRace)race; txtBoxBoolEdit.Text = motorRace.IsSponsored.ToString(); txtSponsorNAme.Text = motorRace.SponsorName.ToString(); txtenginetype.Text = motorRace.EngineType.ToString(); txtRaceid.Text = motorRace.ID.ToString(); timeDatePicker.Text = motorRace.Date.ToString(); txtTime.Text = motorRace.StartTime.ToString(); txtLocation.Text = motorRace.Location.ToString(); txtCapacity.Text = motorRace.Capacity.ToString(); txtCosttt.Text = motorRace.Cost.ToString(); txtRollerCategoryEdit.Visible = false; lblRollerCategoryEdit.Visible = false; } else if (race.GetType() == typeof(PedalRace)) { PedalRace pedalRace = (PedalRace)race; txtRollerCategoryEdit.Text = pedalRace.RollerCategory.ToString(); txtRaceid.Text = pedalRace.ID.ToString(); timeDatePicker.Text = pedalRace.Date.ToString(); txtTime.Text = pedalRace.StartTime.ToString(); txtLocation.Text = pedalRace.Location.ToString(); txtCapacity.Text = pedalRace.Capacity.ToString(); txtCosttt.Text = pedalRace.Cost.ToString(); lblEngineType.Visible = false; lblSponsorName.Visible = false; lblsponsoredit.Visible = false; txtBoxBoolEdit.Visible = false; txtSponsorNAme.Visible = false; cbBoolean.Visible = false; txtenginetype.Visible = false; } }