C# ทำไมอ่านไฟล์ข้อมูลภาษาไทยไม่ได้อ่ะครับ
private void cmdOpen_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { string strPath; strPath = openFileDialog1.FileName;
//อ่านไฟล์ StreamReader sr = new StreamReader(strPath); txtData.Text = sr.ReadToEnd();
lblPathName.Text = strPath; MessageBox.Show("อ่านข้อมูลเรียบร้อยแล้ว", "ผลการตรวจสอบ"); } }
private void cmdExit_Click(object sender, EventArgs e) { this.Close(); }
โค้ดก้อตามนี้อ่ะครับ สามารถเปิดไฟล์ .txt ได้ แต่อ่านได้ เฉพราะภาษาอังกฤษ ไฟล์ .doc อ่านไม่ได้เลย
|