private void listViews_DoubleClick(object sender, System.EventArgs e) { if (listViews.SelectedIndex == -1) { return; } int selected = listViews.SelectedIndex; ApptView ApptViewCur = _listApptViews[listViews.SelectedIndex]; FormApptViewEdit FormAVE = new FormApptViewEdit(); FormAVE.ApptViewCur = ApptViewCur; FormAVE.ClinicNum = _clinicNum; FormAVE.ShowDialog(); if (FormAVE.DialogResult != DialogResult.OK) { return; } viewChanged = true; FillViewList(); if (selected < listViews.Items.Count) { listViews.SelectedIndex = selected; } else { listViews.SelectedIndex = -1; } }
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 }
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 }
private void listViews_DoubleClick(object sender, System.EventArgs e) { if(listViews.SelectedIndex==-1){ return; } int selected=listViews.SelectedIndex; ApptView ApptViewCur=ApptViewC.List[listViews.SelectedIndex]; FormApptViewEdit FormAVE=new FormApptViewEdit(); FormAVE.ApptViewCur=ApptViewCur; FormAVE.ShowDialog(); if(FormAVE.DialogResult!=DialogResult.OK){ return; } viewChanged=true; FillViewList(); if(selected<listViews.Items.Count){ listViews.SelectedIndex=selected; } }