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 228 views
1 answer 223 views
1 answer 66 views
2 answers 143 views
143 views asked Dec 17, 2023 by avibootz
3 answers 170 views
170 views asked Aug 13, 2022 by avibootz
1 answer 189 views
2 answers 179 views
179 views asked Oct 22, 2018 by avibootz
...