Results 1 to 2 of 2

Thread: Specific Lines of text

  1. #1
    MartinWilson is offline Senior Member
    Join Date
    Dec 2009
    Posts
    281
    Rep Power
    3

    Default Specific Lines of text

    Unable to read Specific Lines of text in c# program

    I am doing one small project. In this program I have to read some text from text file. I would like to read only particulars lines from the text file. I have written code for that, but it is not working. I am unable to read particular Lines of text in c# program. Any help would be highly appreciated.

  2. #2
    Davismoore is offline Senior Member
    Join Date
    Dec 2009
    Posts
    284
    Rep Power
    3

    Default

    It is very simple. To read particular Lines of text you have to first import System.Drawing; class in your program. You also have to import System.IO, System.Collections.Generic , System.ComponentModel class. At the present make one string variable and give path of file, from which you would like to get back information. Using the textbox save text in a different file.

    using System;
    using System.IO;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;

    namespace reading
    {
    public partial class Forms1 : Forms
    {
    public Forms1()
    {
    InitializeComponent();
    }

    private void Forms1_Load(object senders, EventArgs es)
    {

    }

    private void btngettext_Click(object sender, EventArgs e)
    {
    StreamReader objstreams = new StreamReader("C:\Documents and Settings\User.ADMIN\Desktop\test.txt");


    textread.Text = objstreams.ReadToEnd();
    }
    }
    }
    Last edited by nitesh14; 02-06-2010 at 03:26 PM.

Similar Threads

  1. read particular Lines of text in c#
    By Davismoore in forum Programming
    Replies: 2
    Last Post: 03-13-2010, 10:35 AM
  2. Edit subject lines in outlook
    By Rob Quiney in forum Networking Jargons
    Replies: 0
    Last Post: 11-13-2009, 12:59 PM
  3. Grey lines on the monitor
    By steven45 in forum Graphic & Displays
    Replies: 1
    Last Post: 06-08-2009, 02:14 PM
  4. Use lines to divide a document
    By enrich444 in forum Everything Else
    Replies: 0
    Last Post: 03-16-2009, 07:41 AM
  5. Add Customer Header Lines To E-mails
    By weerinak in forum Everything Else
    Replies: 0
    Last Post: 08-14-2008, 05:00 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48