VB noob здесь, работая над устаревшим приложением VB 6.0.Функция vb6 не возвращает значение
Когда я проверяю значение 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
Но когда я называю GetNumOfLines от GetATRNames (ниже), 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
Любые идеи о том, почему numOfLines = GetNumOfLines (имя файла) дает мне другое значение, чем когда я проверяю в GetNumOfLines?