How to use open file dialog for open a any file in csharp application

Today i tell how to use open file dialog in our application to open a text file ……

 before you use openfiledialog in your application you put button and text boxYou right following code in button click event.. OpenFileDialog OS = new OpenFileDialog();
           OS.ShowDialog();

           FileStream fs = new FileStream(OS.FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
           StreamReader sr = new StreamReader(fs);
           sr.BaseStream.Seek(0, SeekOrigin.Begin);
           textBox1.Text = sr.ReadToEnd();
           sr.Close();
           fs.Close();

hamarihelp
hamarihelp
Hamarihelp ka main purpose logo ko important jaankari hindi me dena hai jo ki hume sahi time aane par mil sake so please dosto yadi aapki koi query ho to hume email kare ya aap comment box me bhi puch sakte hai admin@hamarihelp.com

Related Articles

Stay Connected

0FansLike
3,913FollowersFollow
0SubscribersSubscribe
- Advertisement -spot_img

Latest Articles