VS 2008 Combo Box question

Discussion created by LokionNitrox on Feb 18, 2011
Latest reply on Feb 22, 2011 by LokionNitrox
I've been mucking with this for too long, so anyone who wants to slap me about the back of the head with this would be greatly appreciated.

I've got a method that is calling out and returning an object[] of my coded value domain descriptions and I would like to push that to a combo box that is part of a dockable window that is a component of an editor extension add-in that I'm building
        public object[] GetDomainValues(String codedvaluedomain)
            IWorkspace ws = (IWorkspace)ArcMap.Editor.EditWorkspace;
            if(ws == null)
                ws = OpenSDEWorkspace("server", "5151", "database", "version", "user", "pass");
            IWorkspaceDomains domains = (IWorkspaceDomains)ws;
            object[] domainobject = null;

                IEnumDomain domainEnum = domains.Domains;
                IDomain domain = domainEnum.Next();
                String name = "";

                while (domain != null)
                    name = domain.Name;
                    domain = domainEnum.Next();
                    if (name.Equals(codedvaluedomain))
                ICodedValueDomain codeddomain = new CodedValueDomainClass();
                codeddomain = domains.get_DomainByName(name) as ICodedValueDomain;
                domainobject = new object[codeddomain.CodeCount];

                for (int a = 0; a < codeddomain.CodeCount; a++)
                    object domainvalue = codeddomain.get_Value(a);
                    String domainvaluename = codeddomain.get_Name(a);
                    domainobject.SetValue(domainvaluename, a);
            return domainobject;

the problem I keep running into is trying to create the entire array as a new object[] on start up/ or at some points even compiling.

I'm attempting to access in this manner:
this.mydomaincombobox.DataSource = this.utils.GetDomainValues(stringcodeddomainname);