none
No overload for method 'this' takes 2 arguments PLEASE HELP RRS feed

  • Question

  • namespace movies { public partial class mainForm : Form { // defines the movie strings string[,] movieString = new string[,] { {"The Avengers", "Walt Disney Motion Pictures", "Robert Downey Jr.", "2012"}, {"Forrest Gump", "Paramount Pictures", "Tom Hanks", "1994"}, {"Practical Magic", "Warner Bros. Pictures", "Sandra Bullock", "1998"}, {"Jaws", "Universal Studios", "Roy Scheider", "1975"}, {"Titanic", "Paramount Pictures", "Leonardo DiCaprio", "1997"}, {"The Prestige", "Warner Bros. Pictures", "Hugh Jackman", "2006"}, {"Back to the Future", "Universal Studios", "Michael J. Fox", "1985"}, {"The Amityville Horror", "MGM", "Ryan Reynolds", "2005"} }; public mainForm() { InitializeComponent(); } private void mainForm_Load(object sender, EventArgs e) { // Defines the array and loads the submects into the combo box int indexInteger = 0; while (indexInteger < 8) { this.movieComboBox.Items.Add(movieString[indexInteger, 0]); ++indexInteger; } } private void displayButton_Click(object sender, EventArgs e) { // Displays information about each movie int selectInteger = 0; string movieString; movieString = this.movieComboBox.Text; while (movieString != movieString[selectInteger, 0]) { ++selectInteger; } this.displaystudioLabel.Text = movieString[selectInteger, 1]; this.actorLabel.Text = movieString[selectInteger, 2]; this.dateLabel.Text = movieString[selectInteger, 3];

    }

    MY ERROR No overload for method 'this' takes 2 arguments IS COMING FROM THE LAST FOUR

    LINES THAT I BOLDED SINCE I CAN'T MAKE THEM RED =).

    WHAT THE HECK DID I DO WRONG? THANKS FOR ANY HELP YOU CAN GIVEN


    Sunday, July 8, 2012 1:43 PM

Answers

  • You named a local variable (string movieString) the same as your array (string[,] movieString) - the compiler doesn't know which one you are trying to reference in each place.  Rename one of them and this should go away.
    • Proposed as answer by Konrad Neitzel Sunday, July 8, 2012 2:14 PM
    • Marked as answer by jbsamom Sunday, July 8, 2012 3:55 PM
    Sunday, July 8, 2012 2:01 PM

All replies

  • You named a local variable (string movieString) the same as your array (string[,] movieString) - the compiler doesn't know which one you are trying to reference in each place.  Rename one of them and this should go away.
    • Proposed as answer by Konrad Neitzel Sunday, July 8, 2012 2:14 PM
    • Marked as answer by jbsamom Sunday, July 8, 2012 3:55 PM
    Sunday, July 8, 2012 2:01 PM
  • OMG..  Thank you.. I cannot believe I missed that..   It works.. THANK YOU,    THANK YOU....   I think at it looked at for WAY too long..

    Have a great day!

    • Marked as answer by jbsamom Sunday, July 8, 2012 3:55 PM
    • Unmarked as answer by jbsamom Sunday, July 8, 2012 3:55 PM
    Sunday, July 8, 2012 2:22 PM