你是说设计时不能在页面显示吧~!就这样vs.net就是不能显示

解决方案 »

  1.   

    did you managed to compile your vb into an assembly at all? did you confused Items (Your ArrayList variable) and Controls? tryimports system
    imports system.web
    imports system.web.ui
    imports system.collections
    namespace mycontrols
        public class simpleRotator2:inherits control
        
        public items as new arraylist()
        
        protected overrides sub addParsedSubObject(obj  as object)
          if (typeof obj is rotatorItem2)
            items.add(obj)
          end if
        end sub
        
        
    protected overrides sub render(objTextWriter as htmlTextWriter)
      dim objrandom as new random
      dim intRanIndex as integer
      dim objSelectedItem as rotatorItem2   if items.count>0 then
        intranindex=objrandom.next(items.count-1)
        objSelectedItem=ctype(items(intranindex),rotatoritem2)
        objTextWriter.write(objselecteditem.text)
        'objTextWriter.write("test")
       end if
        end sub
        
        end class
        
        public class rotatorItem2:inherits control
            public text as string
        end class
        
    end namespace
      

  2.   

    要在调用页面的CS里边再定义一次
    protected mycontrols  simpleRotator2
    应该就可以了