webBrowser1.Url = new Uri("some page has table listing values"); HtmlElement mytable = webBrowser1.Document.GetElementById("I have put class name here (table class name)"); DataTable dtData = new DataTable(); dtData.Columns.Add("column1"); dtData.Columns.Add("column2"); dtData.Columns.Add("column3"); dtData.Columns.Add("column4"); dtData.AcceptChanges(); DataRow dr = null; foreach (HtmlElement row in mytable.GetElementsByTagName("tr")) { dr = dtData.NewRow(); HtmlElementCollection cells = row.GetElementsByTagName("td"); for (int i = 0; i < cells.Count; i++) { dr[i] = cells[i].InnerText; } dtData.Rows.Add(dr); } dtData.AcceptChanges(); dataGridView1.DataSource = dtData; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)