0
我需要找到一種方法來將字符串選定的flashcard調用到新窗體,但我不知道如何傳遞它,因爲我試圖做的是將單個flashcard顯示在將窗口單獨分隔成一個窗體中的標籤,代碼在下面謝謝。在一個單獨的窗口中顯示選定的flashcard
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
}
}
這個問題是否適用於從UserControl獲取信息到表單? – user2304654 2013-04-21 15:46:00
在將它傳遞給表單之前,您將從用戶控件中提取信息。 – 2013-04-21 15:47:08