You need to pass the DataGridViewCellEventArgs to this method because you are using the event Args member data e.RowIndex in your click event and if your moving those operation to a different method pass these value as argument to the method or what is needed for your processing.
usage of e.RowIndex at this line cause the error
sqlQuery = "select * from tblCollectorsregistration where collectorid like '" + this.dgvContactpersonsearch.Rows[e.RowIndex].Cells[0].Value + "' ";