Skip to main content

How to move many records have the same value between two grids


private void MoveManyRecords(DataGridView dtL, DataGridView dtR, int iColToCheck) { if (dtL.CurrentCell == null) return; int iCurrentRowIndex = 0, i = 0; int iLastRow = 0; iCurrentRowIndex = dtL.CurrentCell.RowIndex; string strColToCheckValue = dtL[iColToCheck, iCurrentRowIndex].Value.ToString(); int j = 0; while (j < dtL.Rows.Count) { if (dtL[iColToCheck, j].Value.ToString().Equals(strColToCheckValue)) { dtR.Rows.Add(); iLastRow = dtR.Rows.Count - 1; for (i = 0; i < dtL.Columns.Count; i++) { dtR[i, iLastRow].Value = dtL[i, j].Value; } dtR.Rows[iLastRow].Selected = true; dtR.CurrentCell = dtR.Rows[iLastRow].Cells[1]; dtL.Rows.RemoveAt(j); } else { j++; } } }

Comments

Popular posts from this blog

pligg_validate does not return correct value

Pligg version 1.0.3 Before function pligg_validate(){ // returns the value for register validation return misc_validate; } After function pligg_validate(){ // returns the value for register validation global $db; $sql = "SELECT `var_value` FROM `" . table_config . "` WHERE `var_name` = '" . $db->escape('misc_validate') . "';"; $misc_validate = $db->get_var($sql); return return trim($misc_validate)=="true"?true:false; }

Wrong Referrer with Pligg

To debug the problem, edit /libs/html1.php, find the function check_referrer(). To fix this issue, replace $my_base_url value to ' http://localhost ' as the following code. $my_base_url = ' http://localhost '; $my_pligg_base = ''; $dblang = 'en'; define('table_prefix', 'pligg_'); $language = 'english'; include_once mnminclude.'settings_from_db.php';