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 324 views
1 answer 329 views
1 answer 173 views
2 answers 262 views
262 views asked Dec 17, 2023 by avibootz
3 answers 275 views
275 views asked Aug 13, 2022 by avibootz
1 answer 289 views
2 answers 303 views
303 views asked Oct 22, 2018 by avibootz
...