lunes, 12 de enero de 2015

crear Archivo txt en Visual Basic

How to: Create a File in Visual Basic

How to: Create a File in Visual Basic

Visual Studio 2013
5 out of 10 rated this helpful - Rate this topic
This example creates an empty text file at the specified path using the Create method in the File class.

Imports System
Imports System.IO
Imports System.Text

Module Module1

    Sub Main()
        Dim path As String = "c:\temp\MyTest.txt" 

        ' Create or overwrite the file. 
        Dim fs As FileStream = File.Create(path)

        ' Add text to the file. 
        Dim info As Byte() = New UTF8Encoding(True).GetBytes("This is some text in the file.")
        fs.Write(info, 0, info.Length)
        fs.Close()
    End Sub 

End Module

No hay comentarios:

Publicar un comentario