ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   putting data from hashtable into Excel Validation list (https://www.excelbanter.com/excel-programming/314782-putting-data-hashtable-into-excel-validation-list.html)

Arsi

putting data from hashtable into Excel Validation list
 

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[i].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.XlDVTyp e.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

--
Ars
-----------------------------------------------------------------------
Arsi's Profile: http://www.excelforum.com/member.php...fo&userid=1573
View this thread: http://www.excelforum.com/showthread.php?threadid=27250



All times are GMT +1. The time now is 02:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com