Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 25th, 2004, 05:43 PM
Authorized User
Points: 457, Level: 7
Points: 457, Level: 7 Points: 457, Level: 7 Points: 457, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: Burbank, CA, USA.
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;
            }
        }

*******(*)*******
__________________
*******(*)*******
Reply With Quote
  #2 (permalink)  
Old October 26th, 2004, 10:28 AM
Authorized User
Points: 457, Level: 7
Points: 457, Level: 7 Points: 457, Level: 7 Points: 457, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: Burbank, CA, USA.
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.


*******(*)*******
Reply With Quote
  #3 (permalink)  
Old October 26th, 2004, 11:47 AM
Authorized User
Points: 457, Level: 7
Points: 457, Level: 7 Points: 457, Level: 7 Points: 457, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: Burbank, CA, USA.
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.

*******(*)*******
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:47 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.