How to use Using statement in VB.NET

1 Answer

0 votes
Imports System.IO

Module Module1

    Sub Main()

        Using reader As TextReader = File.OpenText("d:\data.txt")
            Dim l As String

            l = reader.ReadLine()
            Do Until l Is Nothing
                Console.WriteLine(l)
                l = reader.ReadLine()
            Loop
        End Using

    End Sub

End Module

' run:
' 
' c cpp python cshap
' java php

 



answered Sep 29, 2018 by avibootz

Related questions

1 answer 224 views
1 answer 217 views
1 answer 61 views
2 answers 136 views
136 views asked Dec 17, 2023 by avibootz
3 answers 158 views
158 views asked Aug 13, 2022 by avibootz
1 answer 179 views
2 answers 166 views
166 views asked Oct 22, 2018 by avibootz
...