一個用於訪問,另一個用於拾取,當用戶將某個訪問或拾取添加到列表中時,它也會添加到列表框中以向用戶顯示。列表框,選擇索引更改
我的問題是,當我點擊列表框中的項目,例如Indexchanged,我希望它打開與訪問或交付有關的新GUI,因此,如果他們點擊訪問它打開訪問表單爲在我的代碼中顯示了下面的內容,但是我怎樣才能讓它區分列表,以便它知道打開哪個表單?
private void lstVisits_SelectedIndexChanged(object sender, EventArgs e)
{
//Allow the user to click on the listbox to open a visit
//This event is called after the user has clicked on the list
int index = lstVisits.SelectedIndex;
//Get the index of the Visit that the user has clicked upon
Visits selected = theList.getVisits(index);
//Get the visits object from the list
Visitsform.visits = selected;
//Ensure that the appointment form references the selected visit
Visitsform.ShowDialog();
//Show the visits form
updateList();
//update the list as the user may have deleted the appointment
訪問和交付存儲在哪裏?你有兩個列表框用於訪問,一個用於Delivers和/或兩者都添加到同一個列表框? –
它們是兩個不同的列表,一個名爲List.cs的訪問列表和一個名爲pickup lists.cs的存儲deliverys的類,它們都被添加到一個列表框中 – TAM
什麼是'theList'? getVisits(index)'有什麼方法呢? –