private void UdateClicked(object sender, EventArgs e) { Train t = new Train(); t.Trainid = this.Tidtbox.Text; t.Trainname = this.Tnametbox.Text; t.From = this.textBox1.Text; t.To = this.textBox2.Text; t.StartingTime = this.StimeDTP.Value.ToShortTimeString(); t.ReachingTime = this.RtimeDTP.Value.ToShortTimeString(); t.Noofseats = Convert.ToInt32(this.NoStbox.Text); TrainRepository TrainRepo = new TrainRepository(); if (TrainRepo.TrainUpdate(t)) { MessageBox.Show("Train Information Updated", "Update"); } else { MessageBox.Show("Can Not Add Data", "Update Error"); } }