function a() as notesviewentrycollection . . . set a=notesview.getallentriesbykey(key,true) msgbox a.count '这个是有数量的 endfunction通过这个方法无法返回一个notesviewentrycollection对象,似乎对象只能存在于方法中,方法结束对象会被释放,有什么解决方法吗?
Option Public Option Declare Dim vc As NotesViewEntryCollection Class ox Private ovc As NotesViewEntryCollection Sub New End Sub Public Function getVc() As NotesViewEntryCollection Dim ss As New NotesSession Dim vw As NotesView Dim db As NotesDatabase Set db=ss.Currentdatabase Set vw=db.Getview("view_BTTJ2") Set vc=vw.GetAllEntriesByKey("张三", True) Print "方法内:"+CStr(vc.count)+"回复 6# szkenszken
" Set me.ovc=vc End Function Property Get vcs As NotesViewEntryCollection Set vcs=me.ovc End Property End Class Sub Initialize On Error GoTo er Dim oxo As New ox Call oxo.getVc() Set vc=oxo.vcs Print "方法外:"+CStr(vc.count)+"
" Exit Sub er: Print Error & "----" & Erl End Sub
Option Public Option Declare Dim vc As NotesViewEntryCollection Sub Initialize On Error GoTo er Call a() Print "方法外:"+CStr(vc.count)+"测试后方法外没有输出数量,报对象变量未设置错误收起
" Exit Sub er: Print Error & "----" & Erl End Sub Sub a() On Error GoTo er Dim ss As New NotesSession Dim vw As NotesView Dim db As NotesDatabase Set db=ss.Currentdatabase Set vw=db.Getview("view_BTTJ2") Set vc=vw.GetAllEntriesByKey("张三", True) Print "方法内:"+CStr(vc.count)+"
" Exit Sub er: Print Error & "+++" & Erl End Sub