将 MSFlexGrid控件中内容显示内容,显示标题的代码,现在我想将这2段代码封装成一个 ActiveX DLL中,如何实现?
下面2代码是 将 MSFlexGrid控件中内容显示内容,显示标题的代码,现在我想将这2段代码封装成一个 ActiveX DLL中
我直接复制到一个新建的ActiveX DLL中 的类模块下,再编译却提示:
错误提示:提示private 对象模块不能作为参数/公共过程的返回类型,公共数据成员或公共用户定义类型字段在公共的对象中使用
代码如下:
Public Sub gongdandata(MSF1 As MSFlexGrid)
Dim j As Integer
Dim i As Integer
Dim mrc1 As ADODB.Recordset
Dim bhs As New bhsq '用了自定义的类名,而不是用类的工程名
Set mrc1 = bhs.sl(Trim(txtsql))
If mrc1.EOF = False Then
mrc1.MoveFirst
MSF1.RowHeightMin = 410
MSF1.CellAlignment = 0
With MSF1
.Rows = 1
' .RowHeight(0) = 400
Do While Not mrc1.EOF
.Rows = .Rows + 1
For i = 1 To mrc1.Fields.Count
If IsNumeric(mrc1.Fields(i - 1) & "") And mrc1.Fields(i - 1) & "" < 1 And mrc1.Fields(i - 1) & "" <> 0 Then '看是否为数字型,但序号为整数,使用 FormatNumber函数会报错的。
.TextMatrix(.Rows - 1, i - 1) = FormatNumber(mrc1.Fields(i - 1) & "", 2, -1)
Else
.TextMatrix(.Rows - 1, i - 1) = Trim(mrc1.Fields(i - 1) & "")
End If
If i = 20 Then
Select Case mrc1.Fields(i - 1)
Case 0
.TextMatrix(.Rows - 1, i - 1) = "未完结"
Case 1
.TextMatrix(.Rows - 1, i - 1) = "已完结"
Case 2
.TextMatrix(.Rows - 1, i - 1) = "已终止"
End Select
End If
If i <= 24 And i >= 21 Then
If Format(Trim(mrc1.Fields(i - 1) & ""), "yyyy-MM-dd") = Format("1900-01-01", "yyyy-MM-dd") Then
.TextMatrix(.Rows - 1, i - 1) = ""
Else
.TextMatrix(.Rows - 1, i - 1) = Trim(mrc1.Fields(i - 1) & "")
End If
End If
If i = mrc1.Fields.Count Then
Select Case mrc1.Fields(i - 1)
Case 0
.TextMatrix(.Rows - 1, i - 1) = "未确认"
Case 1
.TextMatrix(.Rows - 1, i - 1) = "已确认"
End Select
End If
Next i
mrc1.MoveNext
Loop
mrc1.Close
End With
End If
Set bhs = Nothing
End Sub
Public Sub gongdantitle(MSF1 As MSFlexGrid)
Dim i As Integer
MSF1.Clear
With MSF1
.Cols = 25
.TextMatrix(0, 0) = "ID号"
.TextMatrix(0, 1) = "生产单号"
.TextMatrix(0, 2) = "OC号"
.TextMatrix(0, 3) = "PO号"
.TextMatrix(0, 4) = "产品编号"
.TextMatrix(0, 5) = "产品名称"
.TextMatrix(0, 6) = "客户名称"
.TextMatrix(0, 7) = "数量"
.TextMatrix(0, 8) = "交货日期"
.TextMatrix(0, 9) = "接单日期"
.TextMatrix(0, 10) = "吸塑部人数"
.TextMatrix(0, 11) = "橡胶部人数"
.TextMatrix(0, 12) = "喷油部人数"
.TextMatrix(0, 13) = "装配部人数"
.TextMatrix(0, 14) = "包装部人数"
.TextMatrix(0, 15) = "其它部门数"
.TextMatrix(0, 16) = "其它部门2"
.TextMatrix(0, 17) = "其它部门3"
.TextMatrix(0, 18) = "其它部门4"
.TextMatrix(0, 19) = "是否完结"
.TextMatrix(0, 20) = "预计开工日期"
.TextMatrix(0, 21) = "实际开工日期"
.TextMatrix(0, 22) = "预计完工日期"
.TextMatrix(0, 23) = "实际完工日期"
.TextMatrix(0, 24) = "是否确认"
.ColWidth(0) = 100
.ColWidth(1) = 1800
.ColWidth(2) = 1800
.ColWidth(3) = 1500
.ColWidth(4) = 1500
.ColWidth(5) = 1500
.ColWidth(6) = 1000
.ColWidth(7) = 1000
.ColWidth(8) = 1000
.ColWidth(9) = 1000
.ColWidth(10) = 1000
.ColWidth(11) = 1000
.ColWidth(12) = 1000
.ColWidth(13) = 1000
.ColWidth(14) = 1000
.FixedRows = 1
.FillStyle = flexFillSingle
.Col = 0
.Row = 0
.RowSel = 1
.ColSel = .Cols - 1
.CellAlignment = 0
.Row = 1
End With
End Sub
都是去年问的问题,到目前还未解决....
--------------------编程问答-------------------- 怎么碰不到版主或高手出招??? --------------------编程问答-------------------- 怎么碰不到版主或高手出招???
补充:VB , COM/DCOM/COM+