Erik Borghouts

Erik Borghouts

  • NA
  • 11
  • 32.3k

A property or indexer may not be passed as an out or ref par

Nov 30 2013 3:27 AM

Can't get this work properly: (Write to excel)

FormatRange(ref ws.Range[curRange.Offset[1, 0] , gives A property or indexer may not be passed as an out or ref parameter

Any help would be thankfull

  1. public static void WriteDetailData(ref Worksheet ws, string type, ref int row, int col, Hashtable parts, Hashtable refList)
  2. {
  3. Range curRange = null;
  4. Component component = null;
  5. curRange = ws.Cells[row, col];
  6. curRange.Value = type + "Component Summary";
  7. FormatRange(ref curRange, 10, "Green", true, false, false, XlHAlign.xlHAlignLeft);
  8. curRange.Font.Underline = true;
  9. curRange.Offset[1, 0].Value = "Ref-Desig";
  10. curRange.Offset[1, 1].Value = "Part Number";
  11. curRange.Offset[1, 2].Value = "Shape Code";
  12. curRange.Offset[1, 3].Value = "Type";
  13. curRange.Offset[1, 4].Value = "Side";
  14. curRange.Offset[1, 5].Value = "Pin Count";
  15. FormatRange(ref ws.Range[curRange.Offset[1, 0], curRange.Offset[1, 5]], 9, "Red", true, false, true, XlHAlign.xlHAlignCenter);
  16. row += 2;
  17. foreach (Component component_loopVariable in parts.Values)
  18. {
  19. component = component_loopVariable;
  20. curRange = (Range)ws.Cells[row, 1];
  21. curRange.Value = component.RefDes;
  22. curRange.Offset[0, 1].Value = refList[component.RefDes];
  23. curRange.Offset[0, 2].Value = component.Package.Name;
  24. curRange.Offset[0, 3].Value = component.Package.MountType;
  25. curRange.Offset[0, 4].Value = component.Side.ToString().Substring(4);
  26. curRange.Offset[0, 5].Value = component.Package.Pins.Count;
  27. FormatRange(ref ws.Range[curRange.Offset[0, 1], curRange.Offset[0, 5]], 9, "Black", false, false, true, XlHAlign.xlHAlignLeft);
  28. row += 1;
  29. }



Answers (2)