Advertisement
DrAungWinHtut

FileIO2.cs

Apr 27th, 2022
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.IO;
  11.  
  12. namespace FileIO1
  13. {
  14.     public partial class frmFileIO1 : Form
  15.     {
  16.         public frmFileIO1()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.  
  21.         private void btnReadFile_Click(object sender, EventArgs e)
  22.         {
  23.             string sFname = txtFileName.Text; //sFname ကို User ထည့်ပေးတဲ့ txtFileName ကနေ ယူမယ်
  24.             StreamReader sr = new StreamReader(sFname ); //file name ကို အရှင်ထည့်ဖို့ sFname ကို သုံး
  25.             string sData = sr.ReadToEnd(); //q1 file ထဲက အကုန်ဖတ်လိုက်ပြီး sData ထဲ ထည့်လိုက်တာ
  26.             txtData .Text = sData;
  27.             sr.Close();
  28.         }
  29.     }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement