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://ko.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).

Parents
No Data
Reply
  • 23930
    Suggested Answer
    Offline posted

    Hi,

    Thank you for posting in our forums.

    The ListDataValidation rule is indeed limited to 255 symbols (including the commas). This is because in Excel itself you can only define a DataValidation List with no more than 255 symbols. Since Excel doesn’t support DataValidation Lists longer than 255 characters, our engine also can’t support it.

    Please let me know if you have any additional questions.

Children