title: Does not contain a definition for "foo"
body: <p>I am new to Visual Studio C#. I receive the following error constantly when I'm using some of the methods in System.Windows.Forms </p>
  
  <blockquote>
    <p>System.Windows.Forms.DataGridView does not contain a definition for 'foo' 
    and no extension method 'foo' accepting a first argument of type System.Windows.Forms.DataGridView could be found</p>
  </blockquote>
  
  <p>My code follows:</p>
  
  <pre><code>   private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
      {
              int i;
              i = dataGridView1.CurrentRow.Index
              textBox2.Text = dataGridView1.Item(2, i).Value
      }
  </code></pre>
  
  <p>As I said, I've seen this kind of error more than once, but what's the reason it's ocurring here?
  Thanks</p>
  
  <p>/EDIT:
  As per request I'm adding the whole project:</p>
  
  <pre><code>using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Windows.Forms;
  
  namespace WindowsFormsApplication3
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
  
              //.Designer
          dataGridView1.AllowUserToAddRows = false;
          dataGridView1.Dock = DockStyle.None;
  
          PopulateDataGridView();
          }
          public void PopulateDataGridView()
          {
              dataGridView1.ColumnCount = 3;
              dataGridView1.Columns[0].Name = "ID";
              dataGridView1.Columns[1].Name = "Nombre";
              dataGridView1.Columns[2].Name = "Valor";
              dataGridView1.Columns["ID"].HeaderText = "ID";
              dataGridView1.Columns["Nombre"].HeaderText = "Nombre";
              dataGridView1.Columns["Valor"].HeaderText = "Valor";
  
              //DataGridView.
              dataGridView1.Rows.Add(new string[] { "1", "Nachos", "3.00" });
              dataGridView1.Rows.Add(new string[] { "2", "Pelukas", "5.70" });
              dataGridView1.Rows.Add(new string[] { "3", "Fresas", "3.50" });
              dataGridView1.Rows.Add(new string[] { "4", "Mineral", "5.50" });
              dataGridView1.Rows.Add(new string[] { "5", "Mirinda", "7.80" });
              dataGridView1.Rows.Add(new string[] { "6", "Jamaica", "2.70" });
  
              // Autosize.
              dataGridView1.AutoResizeColumns();
          }
  
          private void Form1_Load(object sender, EventArgs e)
          {
              this.AcceptButton = button7;
              textBox1.Focus();
          }
  
  
          [BrowsableAttribute(false)]
          public DataGridViewRowCollection Rows { get; }
  
         private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
          {
                  int i;
                  i = dataGridView1.CurrentRow.Index
                  textBox2.Text = dataGridView1.Item(2, i).Value
          }
  </code></pre>