1

I am trying to update a datagridview in window form application. Here is my code.

    string[] row = new string[] { Word, txturl.Text, Url, NumOfMatch.ToString() };
    gridview1.Rows.Add(row);
    gridview1.Refresh();
    gridview1.Update();

However when I click on the datagridview the values appear. Why is that?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
themhz
  • 8,335
  • 21
  • 84
  • 109

1 Answers1

1

Instead of using

string[] row = new string[] { Word, txturl.Text, Url, NumOfMatch.ToString() };
gridview1.Rows.Add(row);
gridview1.Refresh();
gridview1.Update();

Try using

            string[] row = new string[] { Word, txturl.Text, Url, NumOfMatch.ToString() };
        gridview1.Rows.Add(row);
        gridview1.Focus();
Svexo
  • 523
  • 1
  • 4
  • 15
  • actualy I had to invoke a deligate in order to work because the process is multithread. So your code worked now fine. Ty – themhz Apr 19 '12 at 00:42