Skip to content
Loading
0
  • 0
    Thanks Kailash, Small thing remaining, how we can move the data to datagridview?
    0
  • 0
    Use foreach loop retrieve data from collection add to gridview using datagridview's rows.add function.
    0
  • 0
    I am just beginner for C#, i have tried to do foreach loop, still not getting it. My code is :

    foreach (Match m in m1)
    {
    dataGridView1.DataSource = m.Value;
    }
    0
  • 0
    Share your strResult value
    0
  • 0
    Main logic of the code is :Once i opened the website link, there is table, that content i need to add in Datagridview.


    Here is my strResults
    0
  • 0
    Right now m not in Office even I don't have pc share from mobile, hence I share code by little assumption. Please correct code, if any mistake is there.
    If you have columns with grid, if not create
    DataRow dr= new DataRow();
    foreach (Match m in m1)
    { 
    String value=m.Value;
    String[] data=value.split(':');
    DataCell dc=new DataCell();
    dc.value=data[1];
    dr.cell.add(dc);

    }
    dataGridView1.rows.add(dr);
    0
  • 0
    Thanks Kailash

    I have modified bit, because it was showing some error: still for Data cell i am getting error, 

    For "DataCell dc = new DataCell();" i am getting error.

    I have modified Datarow by adding data table.

    DataTable table = new DataTable();
    DataRow dr = table.NewRow();

    foreach (Match m in m1)
    {
    String value = m.Value;
    String[] data = value.Split(':');
    DataCell dc = new DataCell();
    dc.value = data[1];
    dr.cell.add(dc);

    }
    dataGridView1.Rows.Add(dr);
    0
  • 0
    Hi,
    Was your problems solved?
    0