🔒 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
  • 555
    Views
  • 1
    Participants
Last reply from:
mac

Online now

Members online
752
Guests online
651
Total visitors
1,403

Forum statistics

Threads
2,276,942
Posts
28,973,215
Members
1,229,649
Latest member
themaharaja
Back
Top