private void btnAdd_Click(object sender, EventArgs e) { gvGrp.AutoGenerateColumns = false; bool addResult; bool addGrp; string _CurUserId = myUtill.loginUser.Userid; Contacts.Service1 ser = new Contacts.Service1(); string grp = ser.grpCreator(myUtill.loginUser.Userid); ser.AddGroup(txtGrp.Text, ref _CurUserId, grp, out addResult, out addGrp); if (addResult == true) { lblmsg.Text = "Group Added"; } else { lblmsg.Text = "Adding Failed !"; } BindingSource bs = new BindingSource(); bs.DataSource = ser.GetData(myUtill.loginUser.Userid); gvGrp.DataSource = bs; //populate(); int _r = 0; foreach (DataGridViewRow gv in gvGrp.Rows) { _r++; string s = gv.Cells[2].Value.ToString(); Contacts.Service1 se = new Contacts.Service1(); string g = se.grpCreator(s); gv.Cells[2].Value = g; try { gvGrp.Rows[_r].Cells[2].Value = g; } catch (Exception ex) { } } }