CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VB >  基础类

未发现可创建的公共类部件!

楼主CS_D_N(含笑半步颠)2005-09-17 00:09:32 在 VB / 基础类 提问

我建立了两个工程,一个是用户控件的,另一个是个测试的窗体(设置为启动),      
  代码也写了一部分,当我把自己做的控件拖放到测试窗体时候,并且把用户控件工程关闭,      
  点击运行时,系统提示:未发现可创建的公共类部件。      
  请教这是为什么? 问题点数:20、回复次数:4Top

1 楼kmlxk(xiaoKKKK)回复于 2005-09-17 01:40:19 得分 20

把控件编译了Top

2 楼CS_D_N(含笑半步颠)回复于 2005-09-17 23:07:03 得分 0

是   Ctrl   +   F5   吗?Top

3 楼CS_D_N(含笑半步颠)回复于 2005-09-17 23:21:17 得分 0

真是晕死了,我编译的过程中出现提示:编译错误,类型不匹配。Top

4 楼CS_D_N(含笑半步颠)回复于 2005-09-17 23:26:57 得分 0

这个我控件里的全部代码:  
  功能也很简单,就是做一个滚动条做数据源  
  请大家帮我看看~  
   
  Option   Explicit  
  Public   Enum   DBTypeEnum  
          access   =   0  
          SqlSever   =   1  
  End   Enum  
  Public   Enum   DBSQLLoginTypeEnum  
          NT   =   0  
          SQl   =   1  
  End   Enum  
   
  Private   conn   As   adodb.Connection  
  Private   rst   As   adodb.Recordset  
   
  Private   blnDBLiker   As   Boolean                                             '数据库连接器  
  Private   strDBName   As   String                                                 '数据库名字  
  Private   strDBTableName   As   String                                       '数据库表名称  
  Private   enuDBType   As   DBTypeEnum                                         '数据库类型  
  Private   strDBHostName   As   String                                         '主机名  
  Private   strDBUserID   As   String                                             '用户名  
  Private   strDBPassword   As   String                                         '密码  
  Private   enuDBSQLSeverLogin   As   DBSQLLoginTypeEnum       'Server登陆类型  
   
   
   
  Public   Property   Get   DBName()   As   String  
          DBName   =   strDBName  
  End   Property  
   
  Public   Property   Let   DBName(ByVal   vNewValue   As   String)  
          strDBName   =   vNewValue  
          PropertyChanged   DBName  
  End   Property  
   
  Public   Property   Get   DBTableNAme()   As   String  
          DBTableNAme   =   strDBTableName  
  End   Property  
   
  Public   Property   Let   DBTableNAme(ByVal   vNewValue   As   String)  
          strDBTableName   =   vNewValue  
          PropertyChanged   DBTableNAme  
  End   Property  
  '连接器  
  Public   Property   Get   DBliker()   As   Boolean  
          DBliker   =   blnDBLiker  
  End   Property  
   
  Public   Property   Let   DBliker(ByVal   vNewValue   As   Boolean)  
          blnDBLiker   =   vNewValue  
          ConToSever  
          GetRst  
  End   Property  
   
  Public   Property   Get   DBType()   As   DBTypeEnum  
          DBType   =   enuDBType  
  End   Property  
   
  Public   Property   Let   DBType(ByVal   vNewValue   As   DBTypeEnum)  
          enuDBType   =   vNewValue  
  End   Property  
   
  Public   Property   Get   DBHostName()   As   String  
          DBHostName   =   strDBHostName  
  End   Property  
   
  Public   Property   Let   DBHostName(ByVal   vNewValue   As   String)  
          strDBHostName   =   vNewValue  
          PropertyChanged   DBHostName  
  End   Property  
   
  Public   Property   Get   DBUserID()   As   String  
          DBUserID   =   strDBUserID  
  End   Property  
   
  Public   Property   Let   DBUserID(ByVal   vNewValue   As   String)  
          strDBUserID   =   vNewValue  
          PropertyChanged   DBUserID  
  End   Property  
   
  Public   Property   Get   DBSQLSeverLogin()   As   DBSQLLoginTypeEnum  
          DBSQLSeverLogin   =   enuDBSQLSeverLogin  
  End   Property  
   
  Public   Property   Let   DBSQLSeverLogin(ByVal   vNewValue   As   DBSQLLoginTypeEnum)  
          enuDBSQLSeverLogin   =   vNewValue  
          PropertyChanged   DBSQLSeverLogin  
  End   Property  
   
  Public   Property   Get   DBPassword()   As   String  
          DBPassword   =   strDBPassword  
  End   Property  
   
  Public   Property   Let   DBPassword(ByVal   vNewValue   As   String)  
          strDBPassword   =   vNewValue  
          PropertyChanged   DBPassword  
  End   Property  
   
  Private   Sub   UserControl_ReadProperties(PropBag   As   PropertyBag)  
          strDBName   =   PropBag.ReadProperty("DBName",   "")  
          strDBTableName   =   PropBag.ReadProperty("DBTable",   "")  
          enuDBType   =   PropBag.ReadProperty("DBType",   0)  
  End   Sub  
   
  Private   Sub   UserControl_WriteProperties(PropBag   As   PropertyBag)  
          PropBag.WriteProperty   "DBName",   DBName,   ""  
          PropBag.WriteProperty   "DBTableNAme",   DBTableNAme,   ""  
          PropBag.WriteProperty   "DBType",   DBType,   0  
  End   Sub  
   
   
  Private   Sub   UserControl_Initialize()  
          Set   conn   =   New   Connection  
          Set   rst   =   New   Recordset  
  End   Sub  
   
  '连接数据库  
  Public   Function   ConToSever()   As   Boolean  
          If   DBliker   =   False   Then  
                  MsgBox   "数据库连接器没有选定连接!"  
          Else  
                  If   conn.State   <>   0   Then  
                          conn.Close  
                          If   DBType   =   SqlSever   Then                                       '如果是SqlSever  
                                  If   DBSQLLoginTypeEnum   =   NT   Then                   '登陆模式为NT  
                                          conn.ConnectionString   =   "Provider=SQLOLEDB.1;"   &   _  
                                              "Integrated   Security=SSPI;Persist   Security   Info=False;"   &   _  
                                              "Initial   Catalog="   &   DBName   &   ";Data   Source="   &   DBHostName  
                                  ElseIf   DBSQLLoginTypeEnum   =   SQl   Then           'SQLserver登陆模式  
                                          conn.ConnectionString   =   "Provider=SQLOLEDB.1;"   &   _  
                                                    "Persist   Security   Info=False;User   ID="   &   DBName   &   ";"   &   _  
                                                    "Initial   Catalog="   &   DBName   &   ";Data   Source=   "   &   DBHostName  
                                  End   If  
                          ElseIf   DBType   =   access   Then                                     'access数据库  
                                  conn.ConnectionString   =   "Provider=Microsoft.Jet.OLEDB.4.0;"   &   _  
                                                  "Data   Source="   &   DBName   &   ";Persist   Security   Info=False"  
                  End   If  
                  On   Error   GoTo   line  
                  conn.Open  
                     
  '                 ConToSever   =   True  
          End   If  
          Exit   Function  
  line:  
          MsgBox   "ConToSever函数中出错!"   &   Err.Description  
  End   Function  
   
  '设置充当数据源  
  Private   Sub   UserControl_GetDataMember(DataMember   As   String,   Data   As   Object)  
          Set   Data   =   rst  
  End   Sub  
   
   
  Public   Function   GetRst()   As   Boolean  
          If   rst.State   =   adStateOpen   Then  
                  rst.Close  
                  GetRst   =   False  
                  Exit   Function  
          End   If  
          rst.CursorType   =   adOpenKeyset  
          On   Error   GoTo   line1  
          rst.Open  
          rst   =   conn.Execute("select   *   from   dbtablename")  
          GetRst   =   True  
          Exit   Function  
  line1:  
          MsgBox   Err.Description  
  End   Function  
  Top

相关问题

  • 急死了,编译dll文件时提示“未发现可创建的公共类部件”,编译不了,什么原因阿?Vb里用form能显示
  • “ActiveX 部件不能创建对象”??????????????????
  • ActiveX 部件不能创建对象: 'Adodb.Stream'???
  • ActiveX 部件不能创建对象: 'Scripting.FileSystemObject'
  • eclipse3.0.1 无法创建jsp部件
  • ActiveX 部件不能创建对象: 'Scripting.FileSystemObject'
  • ActiveX部件不能创建GetObject
  • 创建Word.Application时 ActiveX 部件不能创建对象
  • 关于 ACTIVEX部件不能创建对象。帮帮我吧
  • ActiveX 部件不能创建对象: 'Scripting.FileSystemObject' 怎么解决

关键词

  • 控件
  • 数据库
  • 用户
  • security
  • nt
  • source
  • access
  • dbsqllogintypeenum
  • propertypublic
  • dbname

得分解答快速导航

  • 帖主:CS_D_N
  • kmlxk

相关链接

  • Visual Basic类图书
  • Visual Basic类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo