1 つは訪問用、もう 1 つはピックアップ用です。ユーザーが訪問またはピックアップのいずれかをリストに追加すると、ユーザーに表示するリスト ボックスにも追加されます。
私の質問は、リスト ボックス内の項目、たとえば 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