Friday, February 28, 2025
More
    CsharpHow to use open file dialog for open a any file in...

    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();

    Subscribe Today

    GET EXCLUSIVE FULL ACCESS TO PREMIUM CONTENT

    SUPPORT NONPROFIT JOURNALISM

    EXPERT ANALYSIS OF AND EMERGING TRENDS IN CHILD WELFARE AND JUVENILE JUSTICE

    TOPICAL VIDEO WEBINARS

    Get unlimited access to our EXCLUSIVE Content and our archive of subscriber stories.

    Exclusive content

    - Advertisement -Newspaper WordPress Theme

    Latest article

    More article