Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2430
Can't create DataValidation in Excel
posted

I want a picklist of say several hundred items that I want in Excel.

ListDataValidationRule dvr = new ListDataValidationRule();

foreach(string val in ls)

{

   if (lsV != "")

      lsV += ",";

      lsV += val;

}

dvr.SetValues(lsV);

sheet.Rows[iRow+1].Cells[iCell].DataValidationRule = dvr;

----

Code works fine until I hit around 18 items and the string length exceeds 250.  I also tried ls.ToArray() but it always blows up with too many items in my validation list.


Is there an example to create a validation list with a lot of items???


I was going off of the example in http://es.infragistics.com/samples/windows-forms/infragistics-excel/excel-data-validation.  Can't seem to get it to work with more than 18 items in my list (works fine with < 18).