vb6函数没有返回值

Ant*_*ony 0 vb6

VB noob在这里,处理遗留的VB 6.0应用程序.

当我在下面的函数中检查lineno的值时,我得到了预期的值:

Public Function GetNumOfLines(filename As String) As Integer
    Dim lineno as Integer
    lineno = 0  
    Open App.Path + filename For Input As #1

    Do While Not EOF(1)
        lineno = lineno + 1
        Line Input #1, linevar
        Loop
        Close #1

    MsgBox "numOfLines: " & lineno 'This works
    End Function
Run Code Online (Sandbox Code Playgroud)

但是当我从GetATRNames(下面)调用GetNumOfLines时,numOfLines为0:

Public Function GetATRNames() As String()   
    Dim filename as String  
    filename = "\atrname.dat"
    Dim numOfLines as Integer
    numOfLines = GetNumOfLines(filename)

    MsgBox "numOfLines: " & numOfLines 'This does not
        End Function
Run Code Online (Sandbox Code Playgroud)

关于为什么numOfLines = GetNumOfLines(filename)的任何想法给我一个不同于我在GetNumOfLines中检查时的值?

Pau*_*aul 6

你没有归还这个价值.放:

GetNumOfLines = lineno
Run Code Online (Sandbox Code Playgroud)

在第一个功能结束时.