private void ListFields(List <List <string> > list, bool target = false) { List <string> header = null; List <string> record = null; if (list.Count > 0) { header = list[0]; } if (list.Count > 1) { record = list[1]; } if (header != null) { foreach (string fieldName in header) { HeaderValuePair pair = new HeaderValuePair(); pair.HeaderName = fieldName.Trim(); if (record != null && record.Count >= header.IndexOf(fieldName.Trim()) + 1) { pair.FirstFieldValue = record[header.IndexOf(fieldName.Trim())]; } if (target) { this.exportObj.HeaderList.Add(pair); } else { this.importObj.HeaderList.Add(pair); } if (target) { int idx = this.lstTargetCSV.Items.Add(fieldName.Trim()); } else { int idx = this.lstSourceCSV.Items.Add(fieldName.Trim()); } } } }
private void lstSourceCSV_MouseMove(object sender, MouseEventArgs e) { // See which row is currently under the mouse: int newHoveredIndex = this.lstSourceCSV.IndexFromPoint(e.Location); // If the row has changed since last moving the mouse: if (hoveredIndexSourceCsv != newHoveredIndex) { // Change the variable for the next time we move the mouse: hoveredIndexSourceCsv = newHoveredIndex; // If over a row showing data (rather than blank space): if (hoveredIndexSourceCsv > -1) { //Set tooltip text for the row now under the mouse: this.toolTipSource.Active = false; string header = this.lstSourceCSV.Items[this.hoveredIndexSourceCsv].ToString(); HeaderValuePair pair = this.importObj.HeaderList.Find(l => l.HeaderName.Equals(header)); this.toolTipSource.SetToolTip(this.lstSourceCSV, pair != null?pair.FirstFieldValue:string.Empty); this.toolTipSource.Active = true; } } }