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