c# Display the data in the List view
<pre><code>private void displayResultsButton_Click(object sender, EventArgs e)
    {
        gameResultsListView.Items.Clear();

        //foreach (Game game in footballLeagueDatabase.games)
        //{
            ListViewItem row = new ListViewItem();
            row.SubItems.Add(game.HomeTeam.ToString());
            row.SubItems.Add(game.HomeScore.ToString());
            row.SubItems.Add(game.AwayTeam.ToString());
            row.SubItems.Add(game.AwayScore.ToString());
            gameResultsListView.Items.Add(row);
       // }
        //footballLeagueDatabase.games.Sort();
    }
   }
}
</code></pre>

<p>This is the display button and the following code describes the add button.</p>

<pre><code>private void addGameButton_Click(object sender, EventArgs e)
    {
        if ((homeTeamTxt.Text.Length) == 0)
            MessageBox.Show("You must enter a Home Team");
        else if (homeScoreUpDown.Maximum &lt;= 9 &amp;&amp; homeScoreUpDown.Minimum &gt;= 0)
            MessageBox.Show("You must enter one digit between 0 and 9");
        else if ((awayTeamTxt.Text.Length) == 0)
            MessageBox.Show("You must enter a Away Team");
        else if (awayScoreUpDown.Maximum &lt;= 9 &amp;&amp; awayScoreUpDown.Minimum &gt;= 0)
            MessageBox.Show("You must enter one digit between 0 to 9");
        else 
        {
            //checkGameInputFields();
            game = new Game(homeTeamTxt.Text, int.Parse(homeScoreUpDown.Value.ToString()), awayTeamTxt.Text, int.Parse(awayScoreUpDown.Value.ToString()));
            MessageBox.Show("Home Team" + 't' + homeTeamTxt.Text + "Away Team" + awayTeamTxt.Text + "created");
            footballLeagueDatabase.AddGame(game);

            //clearCreateStudentInputFields();
        }
    }
</code></pre>

<p>I need to insert data into the above text field and Numeric up down control and display them in the list view.
But I dont know How to do it, because when I press the button "Display Results" it displays the error message.</p>

<p>If you know how can I display the data in the list view, please let me know.This is the first time I am using List view.</p>
