Jump to content

Recommended Posts

Posted

Boas, quero criar um .txt com um encoding específico: Unicode.

O meu código:

   Sub pastains()
    System.IO.Directory.CreateDirectory(pasta)
    Using insnew As New StreamWriter(insPath, System.Text.Encoding.UTF32)
    End Using
   End Sub

No insnew, dá este erro:

[/i]
[i]Error 1 Overload resolution failed because no accessible 'New' can be called with these arguments:
   'Public Sub New(path As String, append As Boolean)': Value of type 'System.Text.Encoding' cannot be converted to 'Boolean'.
   'Public Sub New(stream As System.IO.Stream, encoding As System.Text.Encoding)': Value of type 'String' cannot be converted to 'System.IO.Stream'. C:\Programas Feitos Por Mim\VB.Net\STF - Partituras\S.F.T. - Organizador de Partituras de Maestro\Form1.vb 65 15 S.F.T. - Organizador de Partituras de Maestro[/i]
[i]

O que é que eu faço?

Cumps. J.Viana

Learning

  • VB.Net
  • HTML
  • C/C++

Posted (edited)

Não estás a obedecer a todos os parâmetros nesse overload, tenta com

Using insnew As New StreamWriter(insPath, False, System.Text.Encoding.UTF32)
Edited by Caça

Pedro Martins

Não respondo a duvidas por PM

Posted

Neste momento não posso tentar, mas para que serve o False?

É o append. Pode ser para pegar no ficheiro casa exista e continuar a escrever do fim (no caso de true), ou para apagar o que lá estava e começar o ficheiro do 0 (no caso do false)

"Nós somos o que fazemos repetidamente, a excelência não é um feito, e sim, um hábito."
Não respondo a questões por PM que possam ser colocadas no fórum!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.