選択した文字列のフラッシュカードを新しいフォームに呼び出す方法を見つける必要がありますが、それを渡す方法がわかりません。これは、個々のフラッシュカードを別のウィンドウでフォームのラベルに表示するためです。コードは以下のとおりです。
public void FlashcardDisplaylistbox_DoubleClick(object sender, MouseEventArgs e)
{
int index = this.FlashcardDisplaylistbox.IndexFromPoint(e.Location);
if (index != System.Windows.Forms.ListBox.NoMatches)
{
// when an item in listbox is double clicked it will execute this bit of code below
String selectedflashcard = FlashcardDisplaylistbox.SelectedItem.ToString();
MessageBox.Show(selectedflashcard);
MessageBox.Show(FlashcardDisplaylistbox.SelectedIndex.ToString());
int FlashcardID = (int)Flashcards.Rows[FlashcardDisplaylistbox.SelectedIndex][0]; // this section identifies the position of category the user clicks and converts it to a an integer
// the flashcardID will possibly be a way to remove the desired flashcard from the database
}
}