Wrong conclusion.



  • Tell me why this mistake is happening. There's a code

        private void открытьToolStripButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Title = "Открыть";
            dlg.Filter = "txt|*.txt";
            dlg.ShowDialog();
            richTextBox1.LoadFile(dlg.FileName , RichTextBoxStreamType.PlainText );
        }
    

    And I've got some sort of... what do I do instead of a richtextbox'e?



  • Check the original file code, maybe it's Unicode, if it is, correct the challenge.

    richTextBox1.LoadFile(dlg.FileName, RichTextBoxStreamType.UnicodePlainText);
    

    or change the coding of the original file. That's it.

    StreamReader sr = new StreamReader(dlg.FileName, Encoding.Default);
    richTextBox1.Text = sr.ReadToEnd();
    sr.Close();
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2