putting data from hashtable into Excel Validation list

A

Arsi

Hello :confused: ,

I am having trouble with inserting my data in a dropdown list in Exce
using C#. I am inserting the data from an array into a hashtable the
putting them all together in a string variable comma delimited. Usin
this exact same code with a DataTable previously worked very well, bu
now with this array I am receiving the Exception from HRESULT
0X800A03EC error after running the code and Excel opening up. Anyway
Here is the code I wrote if anyone can help me I will appreciate i
greatly:

private void PutWkDateInXL()
{
DisableWorkSheetChanges = true;
int i;
try
{
ThisApplication.ScreenUpdating = false;
for (i = strWkEnd.GetLowerBound(0); i <= strWkEnd.GetUpperBound(0)
i++)
{
strWkDate = strWkEnd.ToString();
// save the dates.
UpdateInfos = new UpdateInfo();
UpdateInfos.SetDate(strWkDate);
// add DATES to hashtable.
DateListHash.Add(UpdateInfos.GetDate(), UpdateInfos);
strDateList += UpdateInfos.GetDate() + ", ";
}
test();
}
finally
{
ThisApplication.ScreenUpdating = true;
DisableWorkSheetChanges = false;
}
}
private void test()
{
try
{
rngUC.get_Offset(0,0).Validation.Add(Excel.XlDVType.xlValidateList,
Excel.XlDVAlertStyle.xlValidAlertStop,
Excel.XlFormatConditionOperator.xlBetween,
strDateList,"");//stops here
rngUC.get_Offset(0,0).Validation.IgnoreBlank = true;
rngUC.get_Offset(0,0).Validation.InCellDropdown = true;
rngUC.get_Offset(0,0).Validation.InputMessage = strInputMessage;
rngUC.get_Offset(0,0).Validation.ShowInput = true;
rngUC.get_Offset(0,0).Value2 = strInputMessage;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK
MessageBoxIcon.Error);
}
}
Also, the array is allocated to 1148 locations and the data consists o
weekending dates. And, the range value is also indicating <cannot vie
indexed property>
 
Top