What does a hash do to a variable in VB?

后端 未结 2 2015
野性不改
野性不改 2021-01-24 05:21

I have to refactor a VB6 program to C# and am stuck at understanding the following lines:

Set myFileSystemObject = New FileSystemObject
Set myTextStream = myFile         


        
2条回答
  •  北恋
    北恋 (楼主)
    2021-01-24 05:52

    Print #iFileNumber, myTextStream.ReadAll prints the string returned by ReadAll into the file opened by number iFileNumber (and because there is no semicolon after the statement, it also adds vbNewLine in the end.)

    The # (for "number") is there since the old times. VB6 just supports it. It does nothing execution wise. It used to assist readability and make the language more natural-like. Speak out loud:

    Open "1.txt" For Input As 1
    

    vs.

    Open "1.txt" For Input As #1
    

提交回复
热议问题