2 Replies - 678 Views - Last Post: 13 May 2010 - 02:04 AM Rate Topic: -----

#1 Guest_Christian*


Reputation:

Select a line in a file opened at runtime

Posted 12 May 2010 - 07:17 AM

Hi,

I have a listBox populated with file paths. Upon double-clicking an item in the listBox, the corresponding file is opened in Visual Web Developer. It's working fine.
Now, I need somehow to select an entire line, say line 3, in the opened file.

Here's my code:

private void listBox1_DoubleClick_1(object sender, EventArgs e)
{
            string file = listBox1.Items[listBox1.SelectedIndex].ToString();
            Process x = Process.Start("VWDExpress.exe", file);
}

This post has been edited by JackOfAllTrades: 12 May 2010 - 08:20 AM
Reason for edit:: Added code tags.


Is This A Good Question/Topic? 0

Replies To: Select a line in a file opened at runtime

#2 SwiftStriker00   User is offline

  • No idea why my code works
  • member icon

Reputation: 439
  • View blog
  • Posts: 1,617
  • Joined: 25-December 08

Re: Select a line in a file opened at runtime

Posted 12 May 2010 - 07:46 AM

If you want to obtain a line from a file, why dont you just open the file with a file reader and read lines untill the one you want? You don't need to open a program.
Was This Post Helpful? 0
  • +
  • -

#3 Guest_Christian*


Reputation:

Re: Select a line in a file opened at runtime

Posted 13 May 2010 - 02:04 AM

Thanks for your reply.

The matter is I don't intend to read a line, but to select (highlight) a line. Simply put, I'd say, when the file opens, the background of a particular line, e.g. line 3 should have a different color that makes it highlighted.....

Any advice will help

Regards
Was This Post Helpful? 0

Page 1 of 1