Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 25th, 2004, 05:43 PM
Authorized User
 
Join Date: Aug 2004
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Arsi
Default Trouble putting data into Excel Drop Down List

Hello everyone,

I am having trouble putting the data from the array into the drop down list. I have a hashtable where the data is input from the array (comma delimited) correctly. But, when it goes to the next line of code, I get an error:
CurrentArray<error: an exception of type:{System.Runtime.InteropServices.COMException} occurred>Microsoft.Office.Interop.Excel.Range. Please, if someone can tell me why I'm getting this error, I'd appreciate it very much.

    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() + ", ";
                }
//the next line is where the error occurs
                rngUC.get_Offset(0,0).Validation.Add(Excel.XlDVTyp e.xlValidateList,
                    Excel.XlDVAlertStyle.xlValidAlertStop,
                    Excel.XlFormatConditionOperator.xlBetween,
                    strDateList.ToString(),"");
                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;
            }
            finally
            {
                ThisApplication.ScreenUpdating = true;
                DisableWorkSheetChanges = false;
            }
        }

*******(*)*******
__________________
*******(*)*******
 
Old October 26th, 2004, 10:28 AM
Authorized User
 
Join Date: Aug 2004
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Arsi
Default

Ok I put in Catch Exception code and I receive this error as soon as excel opens: Exception from HRESULT: 0X800A03EC. I haven't been able to figure out why I'm getting this error. If anyone can help me I will appreciate it very much.


*******(*)*******
 
Old October 26th, 2004, 11:47 AM
Authorized User
 
Join Date: Aug 2004
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Arsi
Default

the range also indicates <cannot view indexed property>...Please can anyone suggest something...even an alternative way to do this? I am running out of time. Thank you.

*******(*)*******





Similar Threads
Thread Thread Starter Forum Replies Last Post
populate a drop list fro a data table greenbriar ADO.NET 2 July 22nd, 2008 10:18 PM
Get data from database based on drop down list sel stapes ASP.NET 2.0 Basics 0 May 22nd, 2008 11:15 AM
Unable to display data using drop down list hayley Classic ASP Databases 2 January 18th, 2005 05:36 AM
Data Grid Drop Down List Column bmains ASP.NET 1.0 and 1.1 Professional 4 September 21st, 2004 08:39 AM
Read drop-down list validated in Excel KathleenS Excel VBA 1 August 10th, 2003 08:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.