How to retrieve data from file(notepad) using c# in client side

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saranraj
    New Member
    • Jun 2007
    • 2

    How to retrieve data from file(notepad) using c# in client side

    Platform : Visual Studio 2005
    Language : Visual C#
    We need code to retrieve data from notepad in client side for WebApplication
  • cmorgan76
    New Member
    • Jun 2007
    • 11

    #2
    Do you want to open a text file and read it?

    Comment

    • tal170
      New Member
      • Jun 2007
      • 7

      #3
      you have to add using System.IO at the top
      and then you open the text file using the StreamReader object


      example

      string mytext;
      StreamReader read = new StreamReader("1 .txt");
      mytext = read.ReadLine() ;

      Comment

      • saranraj
        New Member
        • Jun 2007
        • 2

        #4
        Yes I have to read file.

        Comment

        • nmsreddi
          Contributor
          • Jul 2006
          • 366

          #5
          Hello

          What do you mean reading textfile at client side ,

          you want to readfiles that client uploaded using your application .where the file that you want to read resides ,do you know thepath of that file,

          please send some details so that you can get goodresponse

          Comment

          • slapshock
            New Member
            • Oct 2006
            • 57

            #6
            use the stream reader in reading data from textfile
            this is a c# code,if you are using vb.net,just try to understand and convert this code to vb.net...


            using system.io;

            streamreader read= file.opentext(" sample.txt");
            string input=null;
            whiel((input=re ad.readline)!=n ull)
            {
            richtextbox.app endtext(input);
            }
            read.close();

            this code can read multi line data in the text file


            enjoy coding,hope this can help you

            Comment

            • kamalsuriya
              New Member
              • Jul 2007
              • 1

              #7
              This is your C# code in the form of VB.
              My problem is , It not return multiple line from text file.
              Because, In Vb , How Can I compare NULL in while Condition ?
              Reply your response to <Removed> also...

              VB.NET
              Dim input As String = ""
              Dim read As StreamReader
              read = File.OpenText(" textfile.txt")
              While ((input = read.ReadLine) <> False)
              RichTextBox1.Ap pendText(input)
              End While
              read.Close()




              Originally posted by slapshock
              use the stream reader in reading data from textfile
              this is a c# code,if you are using vb.net,just try to understand and convert this code to vb.net...


              using system.io;

              streamreader read= file.opentext(" sample.txt");
              string input=null;
              whiel((input=re ad.readline)!=n ull)
              {
              richtextbox.app endtext(input);
              }
              read.close();

              this code can read multi line data in the text file


              enjoy coding,hope this can help you
              Last edited by r035198x; Jul 3 '07, 07:05 AM. Reason: posting emails in public forums is against site rules

              Comment

              Working...