关于notesvew.GetAllEntriesByKey的问题

function a() as notesviewentrycollection
    .
    .
    .
    set a=notesview.getallentriesbykey(key,true)
    msgbox a.count  '这个是有数量的
endfunction
通过这个方法无法返回一个notesviewentrycollection对象,似乎对象只能存在于方法中,方法结束对象会被释放,有什么解决方法吗?
参与20

16同行回答

rzf006rzf006软件开发工程师华腾
Option Public Option Declare Dim vc As NotesViewEntryCollection Class ox                 Private ovc As NotesViewEntryCollection         Sub New               &...显示全部
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)+"
"                 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
回复 6# szkenszken

测试后仍然没有效果,方法外无法获取notesviewentrycollection对象收起
互联网服务 · 2015-07-24
浏览2330
rzf006rzf006软件开发工程师华腾
回复 5# Domino-斌少 Option Public Option Declare Dim vc As NotesViewEntryCollection Sub Initialize         On Error GoTo er         Call a()         Print "方法外:"+C...显示全部
回复 5# Domino-斌少


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
测试后方法外没有输出数量,报对象变量未设置错误收起
互联网服务 · 2015-07-24
浏览1197
szkenszkenszkenszken其它contempo
定义一个class, 把返回值放到class 的的一个属性显示全部
定义一个class, 把返回值放到class 的的一个属性收起
互联网服务 · 2015-07-24
浏览1176
rzf006rzf006软件开发工程师华腾
回复 3# spyxy    定义全局变量也不行,在方法中给这个全局变量赋值,方法执行完毕后,这个全局变量仍然为nothing,变量只是指向了方法中的notesviewentrycollection对象显示全部
回复 3# spyxy


   定义全局变量也不行,在方法中给这个全局变量赋值,方法执行完毕后,这个全局变量仍然为nothing,变量只是指向了方法中的notesviewentrycollection对象收起
互联网服务 · 2015-07-24
浏览1160
spyxyspyxy系统运维工程师意能软件
没有这么用过,一般我是定义全局变量的。显示全部
没有这么用过,一般我是定义全局变量的。收起
软件开发 · 2015-07-24
浏览1121
rzf006rzf006软件开发工程师华腾
:(1  难道没有人遇到过吗???显示全部
:(1  难道没有人遇到过吗???收起
互联网服务 · 2015-07-23
浏览1114

提问者

rzf006
软件开发工程师华腾
擅长领域: 安全

相关问题

相关资料

问题状态

  • 发布时间:2015-07-22
  • 关注会员:2 人
  • 问题浏览:17959
  • 最近回答:2015-11-18
  • X社区推广