C# 在单独的窗口中显示选定的抽认卡
我需要找到一种方法将string selected flashcard调用到一个新表单,但我不知道如何传递它,因为我正在尝试在单独的窗口中将单个flashcard显示到表单中的标签中,代码如下,谢谢C# 在单独的窗口中显示选定的抽认卡,c#,C#,我需要找到一种方法将string selected flashcard调用到一个新表单,但我不知道如何传递它,因为我正在尝试在单独的窗口中将单个flashcard显示到表单中的标签中,代码如下,谢谢 public void FlashcardDisplaylistbox_DoubleClick(object sender, MouseEventArgs e) { int index = this.FlashcardDisplaylistbox.IndexFromPoint(e.Locat
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
}
}
如果我理解正确(并且您使用的是windows窗体),则需要将参数传递到其他窗体,以便它显示在标签中
在这种情况下,的答案应该对您有所帮助。该问题是否适用于从UserControl获取表单信息?您可以在将信息传递给表单之前从UserControl提取信息。