Click here to Skip to main content
15,902,635 members
Home / Discussions / C#
   

C#

 
QuestionMS Word and Excel from C# Pin
Piyush Vaishnav27-Aug-08 0:38
Piyush Vaishnav27-Aug-08 0:38 
AnswerRe: MS Word and Excel from C# Pin
Manas Bhardwaj27-Aug-08 0:49
professionalManas Bhardwaj27-Aug-08 0:49 
AnswerRe: MS Word and Excel from C# Pin
Anthony Mushrow27-Aug-08 1:43
professionalAnthony Mushrow27-Aug-08 1:43 
GeneralRe: MS Word and Excel from C# Pin
Piyush Vaishnav27-Aug-08 18:10
Piyush Vaishnav27-Aug-08 18:10 
QuestionReaching sql database diagram using smo ?? Pin
omegazafer26-Aug-08 23:43
omegazafer26-Aug-08 23:43 
AnswerIgnore Repost Pin
Manas Bhardwaj27-Aug-08 0:04
professionalManas Bhardwaj27-Aug-08 0:04 
QuestionDatetimePicker problem. [modified] Pin
vinay_K26-Aug-08 23:38
vinay_K26-Aug-08 23:38 
QuestionComClass in C# Pin
Saranya B26-Aug-08 23:37
Saranya B26-Aug-08 23:37 
Hello Everybody,
How can we create a class using ComClass Template.
First of all, I am not able to add the reference of Microsoft.Build.Tasks.V3.5 since it is not being listed out in the Add Reference dialog. So I browsed this dll and added the reference.
Still my problem is not solved. I am getting the following error.
'Microsoft.Build.Tasks.Deployment.ManifestUtilities.ComClass' is not an attribute class
I am not sure.
Here is my code,
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Build.Tasks.Deployment.ManifestUtilities;

namespace COMArray
{
[ComClass(ComClass2.ClassId, ComClass2.InterfaceId, ComClass2.EventsId)]
    
    public class ComClass2
    {
        

        #region "COM GUIDs"
        // These GUIDs provide the COM identity for this class 
        // and its COM interfaces. If you change them, existing 
        // clients will no longer be able to access the class. 
        public const string ClassId = "83a8275f-9282-4257-ba62-afab6ed03beb";
        public const string InterfaceId = "e75a1569-f1aa-4bdc-8e39-ae5807ee5baa";
        public const string EventsId = "f966bdd3-9c5b-4ad9-8714-bc17d28f7e3a";
        #endregion

        // A creatable COM class must have a Public Sub New() 
        // with no parameters, otherwise, the class will not be 
        // registered in the COM registry and cannot be created 
        // via CreateObject. 
        public ComClass2()
            : base()
        {
        }

        private int _test;
        public int test
        {
            get { return _test; }
            set { _test = value; }
        }

    }


   [ComClass(ComClass1.ClassId, ComClass1.InterfaceId, ComClass1.EventsId)]
    public class ComClass1
    {

        #region "COM GUIDs"
        // These GUIDs provide the COM identity for this class 
        // and its COM interfaces. If you change them, existing 
        // clients will no longer be able to access the class. 
        public const string ClassId = "35cf06df-5ed3-431f-9780-1e30d8acb94c";
        public const string InterfaceId = "04fcc0fb-da33-4750-bab1-86e3b6d0e300";
        public const string EventsId = "e073bca9-3bc5-437a-8c77-a489086c6517";
        #endregion

        // A creatable COM class must have a Public Sub New() 
        // with no parameters, otherwise, the class will not be 
        // registered in the COM registry and cannot be created 
        // via CreateObject. 
        public ComClass1()
            : base()
        {
        }

        private ComClass2[] t;
        public ComClass2[] myFunction()
        {
            // ERROR: Not supported in C#: ReDimStatement 
            t(0) = new ComClass2();
            t(1) = new ComClass2();
            t(0).test = 111;
            t(1).test = 222;
            return t;
        }
    } 
}


Am I on track? Am I using the ComClass properly.Can anybody guide me through the ComClass attribute usage? I just want to create a class using ComClass Template.

Any help is greatly appreciated.

Cheers,
Saran
Questionhow can i change machain date Pin
Mohammed Elkholy26-Aug-08 23:30
Mohammed Elkholy26-Aug-08 23:30 
JokeRe: how can i change machain date Pin
Manas Bhardwaj27-Aug-08 0:07
professionalManas Bhardwaj27-Aug-08 0:07 
GeneralRe: how can i change machain date Pin
Mohammed Elkholy27-Aug-08 5:14
Mohammed Elkholy27-Aug-08 5:14 
AnswerRe: how can i change machain date Pin
varun_mca_ju27-Aug-08 0:39
varun_mca_ju27-Aug-08 0:39 
AnswerRe: how can i change machain date Pin
lisan_al_ghaib27-Aug-08 0:49
lisan_al_ghaib27-Aug-08 0:49 
GeneralRe: how can i change machain date Pin
Mohammed Elkholy27-Aug-08 5:16
Mohammed Elkholy27-Aug-08 5:16 
GeneralRe: how can i change machain date Pin
lisan_al_ghaib27-Aug-08 5:49
lisan_al_ghaib27-Aug-08 5:49 
QuestionClass inheritance question Pin
Mc_Topaz26-Aug-08 23:17
Mc_Topaz26-Aug-08 23:17 
AnswerRe: Class inheritance question Pin
Manas Bhardwaj26-Aug-08 23:19
professionalManas Bhardwaj26-Aug-08 23:19 
AnswerRe: Class inheritance question Pin
lisan_al_ghaib26-Aug-08 23:35
lisan_al_ghaib26-Aug-08 23:35 
AnswerRe: Class inheritance question Pin
Saranya B26-Aug-08 23:46
Saranya B26-Aug-08 23:46 
AnswerRe: Class inheritance question Pin
Pete O'Hanlon27-Aug-08 0:41
mvePete O'Hanlon27-Aug-08 0:41 
QuestionRe: Class inheritance question, new explanation Pin
Mc_Topaz27-Aug-08 1:19
Mc_Topaz27-Aug-08 1:19 
AnswerRe: Class inheritance question, new explanation Pin
lisan_al_ghaib27-Aug-08 1:36
lisan_al_ghaib27-Aug-08 1:36 
GeneralRe: Class inheritance question, new explanation Pin
Mc_Topaz27-Aug-08 3:52
Mc_Topaz27-Aug-08 3:52 
AnswerRe: Class inheritance question, new explanation Pin
Colin Angus Mackay27-Aug-08 1:46
Colin Angus Mackay27-Aug-08 1:46 
AnswerRe: Class inheritance question, new explanation Pin
Pete O'Hanlon27-Aug-08 2:08
mvePete O'Hanlon27-Aug-08 2:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.