未发现可创建的公共类部件!
我建立了两个工程,一个是用户控件的,另一个是个测试的窗体(设置为启动),
代码也写了一部分,当我把自己做的控件拖放到测试窗体时候,并且把用户控件工程关闭,
点击运行时,系统提示:未发现可创建的公共类部件。
请教这是为什么?
问题点数: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' 怎么解决




