title: Object Array, retrieve data to text boxes
body: <p>I'm creating a program that allows a user to type various data into 6 separate text boxes and then save it into an object called Book. Now I have done this easily but now i wish to be able to select the Book object in the listbox and populate the data back to the text boxes, i assumed it would be as easy as reversing the add to a degree but i have hit a roadblock.</p>
  
  <p>Here is the primary part of my add button for context (I have commented it to hopefully clear up any variable names)</p>
  
  <pre><code>//use class book to create a new book 
  Book addBook = new Book();
  //use int.tryparse to convert the txtISBN to an int and store in the book object
  bool parsed = int.TryParse(txtISBN.Text, out int isbn);
  if (parsed)
  {
      addBook.gsISBN = isbn;
  }
  else
  {
      MessageBox.Show("Invalid ISBN, Please enter an integer value");
      return;
  }
  //use double.tryparse to convert the txtPrice into a double and store in the book object
  bool parse = double.TryParse(txtPrice.Text, out double price);
  if (parsed)
  {
      addBook.gsPrice = price;
  }
  else
  {
      MessageBox.Show("Invalid Price, please enter a double value");
      return;
  }
  //use object addBook with the various getters and setters for 
  //each variable and have them equal their textbox equivalent .
  addBook.gsAuthor = txtAuthor.Text;
  addBook.gsTitle = txtBookTitle.Text;
  addBook.gsPublisher = txtPublisher.Text;
  addBook.gsDate = txtDate.Text;
  //myBooks( this is the Array)
  myBooks[currentIndex] = addBook;
  </code></pre>
  
  <p>This above chunk of code works but then the below does not and is what i hope to figure out.</p>
  
  <pre><code>private void lstbook_SelectedIndexChanged(object sender, EventArgs e)
  {
      if (lstbook.SelectedIndex == -1)//if there is no selected game output error message
      {
          MessageBox.Show("Please select a book");
      }
      else
      {
          int index = lstbook.SelectedIndex;
          Book getBook = new Book();
          myBooks[currentIndex] = getBook;
          txtAuthor.Text = getBook.gsAuthor;
      }
  }
  </code></pre>