leo2012 Posted July 22, 2012 Report Share Posted July 22, 2012 (edited) Como eu faço pro meu Richtextbox aceitar acentos? olha o código que eu tenho até agora: RichTextBox1.Text = My.Computer.FileSystem.ReadAllText(OpenFileDialog1.FileName) Mas isso só lê o arquivo,e nao reconhece os acentos Edited July 22, 2012 by ribeiro55 Link to comment Share on other sites More sharing options...
ribeiro55 Posted July 22, 2012 Report Share Posted July 22, 2012 http://wiki.portugal-a-programar.pt/dev_net:vb.net:stream_readers_writers#porque_razao_nao_e_possivel_ler_caracteres_especiais_como_acentos Esse ReadAllText é uma implementação "straightforward", para casos menos específicos. Experimenta com um StreamReader, como se demonstra no artigo. Sérgio Ribeiro "Great coders aren't born. They're compiled and released""Expert coders do not need a keyboard. They just throw magnets at the RAM chips" Link to comment Share on other sites More sharing options...
leo2012 Posted July 22, 2012 Author Report Share Posted July 22, 2012 (edited) Nao consegui :/ tentei esse código,mas ele só exibe a primeira linha do documento Dim SR As New IO.StreamReader(OpenFileDialog1.FileName, System.Text.Encoding.Default) While Not SR.EndOfStream RichTextBox1.Text = SR.ReadLine End While SR.Close() Edited July 23, 2012 by ribeiro55 Link to comment Share on other sites More sharing options...
leo2012 Posted July 22, 2012 Author Report Share Posted July 22, 2012 (edited) Consegui,olha,vou postar o código pra quem estiver com o mesmo problema, O ReadLine,estava impedindo a leitura de todas as linhas,entao coloquei ReadEnd,assim ele le o arquivo ate o final 👍 Dim SR As New IO.StreamReader(OpenFileDialog1.FileName, System.Text.Encoding.Default) RichTextBox1.Text = SR.ReadToEnd Edited July 23, 2012 by ribeiro55 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now