private void add_Click(object sender, EventArgs e) { TrainAdd add = new TrainAdd(); add.ShowDialog(); DataView dv = (DataView)this.dgvtrainInfo.DataSource; dv.Table.Rows.Clear(); this.dgvtrainInfo.DataSource = dv; this.dgvtrainInfo.DataSource = getAllTrain().DefaultView; }
/// <summary> /// Raise the <see cref="TrainAdd"/> event. /// </summary> /// <param name="item">The train which has been added to the collection.</param> /// <param name="idx">The index at which the train was added to the collection.</param> protected override void OnAdd(Train item, int?idx) { TrainAdd?.Invoke(this, new TrainEventArgs { Train = item }); }