0

I need to find a way to call string selected flashcard to a new form but I have no idea how to pass it through because what i'm trying to do is display that individual flashcard in a separate window into a label in a form, the code is below Thanks.

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
    }
}
pascalhein
  • 5,700
  • 4
  • 31
  • 44

1 Answers1

1

If I understand you correctly (and you're using windows forms) you need to pass a parameter to a different form for it to be displayed in a label.

In that case the answer to this question should help you.

Community
  • 1
  • 1
m.edmondson
  • 30,382
  • 27
  • 123
  • 206