private void butAdd_Click(object sender, System.EventArgs e) { ApptView ApptViewCur = new ApptView(); if (_listApptViews.Count == 0) { ApptViewCur.ItemOrder = 0; } else { ApptViewCur.ItemOrder = _listApptViews[_listApptViews.Count - 1].ItemOrder + 1; } ApptViewCur.ApptTimeScrollStart = DateTime.Parse("08:00:00").TimeOfDay; //default to 8 AM ApptViews.Insert(ApptViewCur); //this also gets the primary key FormApptViewEdit FormAVE = new FormApptViewEdit(); FormAVE.ApptViewCur = ApptViewCur; FormAVE.IsNew = true; FormAVE.ClinicNum = _clinicNum; FormAVE.ShowDialog(); if (FormAVE.DialogResult != DialogResult.OK) { return; } viewChanged = true; FillViewList(); listViews.SelectedIndex = listViews.Items.Count - 1; //this works even if no items }
private void butAdd_Click(object sender, System.EventArgs e) { ApptView ApptViewCur = new ApptView(); ApptViewCur.ItemOrder = ApptViewC.List.Length; ApptViews.Insert(ApptViewCur); //this also gets the primary key FormApptViewEdit FormAVE = new FormApptViewEdit(); FormAVE.ApptViewCur = ApptViewCur; FormAVE.IsNew = true; FormAVE.ShowDialog(); if (FormAVE.DialogResult != DialogResult.OK) { return; } viewChanged = true; FillViewList(); listViews.SelectedIndex = listViews.Items.Count - 1; //this works even if no items }