🔒 Closed Open multi lined text file and read only an specific line in it. and send the value to a textbox

Status
Not open for further replies.

mac

Leecher
-2You do not have permission to view the full content of this post. Log in or register now.


I have created a code that generates a multi lined text file.

What i would like to achieve is read only a specific line and send that value to a specific textbox.

Below is my form :

wX3YN.webp

My Text file sample and What i want to achieve please see below :

pBnOE.webp

Please see below my code :


var open = new OpenFileDialog();

open.Title = "Open File";

open.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";

if (open.ShowDialog() == DialogResult.OK)
{

FilePathLB.Text = open.InitialDirectory + open.FileName;

StreamReader read = new StreamReader(File.OpenRead(open.FileName));

//X1TB.Text = File.ReadLines(open.FileName).Skip(1).Take(1).First();
//X1TB.Text = read.ReadLine();
X1TB.Text = read.ReadLine();




read.Dispose();
}

Salamat sa mga tutulong.
 
Status
Not open for further replies.

About this Thread

  • 0
    Replies
  • 565
    Views
  • 1
    Participants
Last reply from:
mac

Trending Topics

Online now

Members online
780
Guests online
1,410
Total visitors
2,190

Forum statistics

Threads
2,292,273
Posts
29,075,840
Members
1,210,247
Latest member
pips_424
Back
Top