vb6

What does Get do in VB6?


I'm trying to modify a program someone wrote in VB6 in the sem-distant past, and have come across the line below, and many similar ones. My question is, syntactically, what does this "Get" line look like it does or might do?

  Get #3, StartByte + Offset, StudentScrBytes

Within the program, it's ALWAYS followed by 3 comma-separated items, and with one exception, the first item is a number preceded by #. The second looks to always resolve to a number, and the third a single variable.

I'm fairly sure I've figured out the numbers preceded by # are a file reference - the first time Get appears, instead of #3 or #10 or #whatever, it has a variable "TempFile" instead, initialized as FreeFile().

  TempFile = FreeFile()
  Open "c:\folerName.dir" For Binary Shared As TempFile

The only stuff I've been able to find on Get in VB6, seems to relate to OOP and getters/setters. Maybe I'm wrong, but I really don't think that's what's going on here, and all I have are vague guesses as to what is.

Here's the function the line was taken from. Both arguments are integers.

Function StudentScr$(Record, Contest)

  Dim StudentScrBytes As String * 4
  StartByte = (Record - 1) * LengthOfStudentRecord
  If Contest = 1 Then Offset = 77
  If Contest = 2 Then Offset = 85
  If Contest = 3 Then Offset = 94
  If Contest = 4 Then Offset = 102
  If Contest = 5 Then Offset = 110
  If Contest = 6 Then Offset = 118
  If Contest = 7 Then Offset = 126
  If Contest = 8 Then Offset = 134
  Get #3, StartByte + Offset, StudentScrBytes
  StudentScr$ = StudentScrBytes

End Function

I would think Get would get something from the specified file, except I can't tell how (or if) a file is even specified at all.


Solution

  • Have a look at the original MS VB6 documentation:

    https://msdn.microsoft.com/en-us/library/aa243376(v=vs.60).aspx

    You may also be interested in its counterpart Put:

    https://msdn.microsoft.com/en-us/library/aa266212(v=vs.60).aspx

    Hint: when searching for legacy VB statements, include "vs.60" for Visual Studio 6.0 in your Google search, and restrict your search to the MS site. MS hast this term in the official link, so you can not miss it. This search:

    vb6 vs.60 get put site:microsoft.com

    does bring up both Get and Put as the two first Google answers on my machine.