Skip to content
Loading
How to separate it with comma if data is more than 1 ?
  • Nitin Sontakke
    currQty += (currQty.Length == 0 ? "" : ", " ) + row.Cells["dbbname"].Value;
  • Uday Dodiya

    String currQty = "";  
    foreach (DataGridViewRow row in dataGridView1.Rows)  
    {  
        currQty = currQty + ',' + row.Cells["dbbname"].Value;  
    }  
    currQty = currQty.Substring(1,currQty.Length-2);  
    MessageBox.Show(currQty);  

    try this code you get excat output

    i add following line because remove first and last ,

    currQty = currQty.Substring(1,currQty.Length-2);