コード例 #1
0
 public fOpenText(string path, Loaifile loai)
 {
     InitializeComponent();
     this.path = path;
     if (loai == Loaifile.Txt)
     {
         richTextBox1.Text = XTxt.ReadText(path);
     }
     else if (loai == Loaifile.Word)
     {
         richTextBox1.Rtf = XWord.ReadWord(path);
     }
 }
コード例 #2
0
 public fOpenText(string path, string tuboiden, Loaifile loai)
 {
     InitializeComponent();
     this.path = path;
     if (loai == Loaifile.Txt)
     {
         richTextBox1.Text = XTxt.ReadText(path);
     }
     else if (loai == Loaifile.Word)
     {
         richTextBox1.Rtf = XWord.ReadWord(path);
     }
     //boi dam tu tim kiem
     this.Boldstring = tuboiden;
     textBox1.Text   = Boldstring;
     boiden();
 }
コード例 #3
0
 private void openFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     open        = new OpenFileDialog();
     open.Title  = "Chọn file text đuôi .txt";
     open.Filter = "All Files|*.*";
     if (open.ShowDialog() == DialogResult.OK)
     {
         try
         {
             if (open.FileName.Contains(".doc") || open.FileName.Contains(".docx"))
             {
                 richTextBox1.Rtf = XWord.ReadWord(open.FileName);
             }
             else
             {
                 richTextBox1.Text = XTxt.ReadText(open.FileName);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Đã xảy ra lỗi" + ex.Message);
         }
     }
 }