Hi all,
hopefully one of you will be able to speed this thing up for me,
I have two datagrids, one stores the details of people aka dgvpeople and the other stores the groups aka dgvgroups. by selecting rows within the dgvpeople and then adding to group it will save these to the group cell which I have working, I also have the remove part of this working. however I have over 1000 people in the dgvpeople and when the remove part is run the loop takes quite some time to complete I have attached the code below is there a quicker way to complete this loop, so that the screen does not freeze the gui for the user for a period of short period of time.
it is using stringbuilder ie sb.
###################################################
Code below
For i = 0 To dgvpeople.RowCount - 1
For r = 0 To selectedRowCount - 1
'Below searches and then replaces all <Row Index> found to "" in effect removing them
If SelCel.Contains("<" + dgvpeople.SelectedRows(r).Index.ToString() + ">") Then
NewCel = ("<" + dgvpeople.SelectedRows(r).Index.ToString() + ">")
'//////////////////////////////////////////////////////////////////////////////
sb.Replace(NewCel, "").ToString()
GRPdgv.CurrentCell.Value = sb.ToString
SelCel = sb.ToString
'/////////////////////////////////////////////////////////////////////////////
End If
Next r
Next i
hopefully one of you will be able to speed this thing up for me,
I have two datagrids, one stores the details of people aka dgvpeople and the other stores the groups aka dgvgroups. by selecting rows within the dgvpeople and then adding to group it will save these to the group cell which I have working, I also have the remove part of this working. however I have over 1000 people in the dgvpeople and when the remove part is run the loop takes quite some time to complete I have attached the code below is there a quicker way to complete this loop, so that the screen does not freeze the gui for the user for a period of short period of time.
it is using stringbuilder ie sb.
###################################################
Code below
For i = 0 To dgvpeople.RowCount - 1
For r = 0 To selectedRowCount - 1
'Below searches and then replaces all <Row Index> found to "" in effect removing them
If SelCel.Contains("<" + dgvpeople.SelectedRows(r).Index.ToString() + ">") Then
NewCel = ("<" + dgvpeople.SelectedRows(r).Index.ToString() + ">")
'//////////////////////////////////////////////////////////////////////////////
sb.Replace(NewCel, "").ToString()
GRPdgv.CurrentCell.Value = sb.ToString
SelCel = sb.ToString
'/////////////////////////////////////////////////////////////////////////////
End If
Next r
Next i