Hello there guys.
I have a multiline text box. Like this:
57723882
99665588
11225544
So, I have a double click event (currently has wrong code)
I want the string _selectedline to be = the current selected line +".txt, so that, when I doubleclick on an specific line, it will open for example 99665588.txt
The code below is good, but I don't know how to get the string value of the selected line of the textbox.
Thanks Guys
private void TB_result_MouseDoubleClick(object sender, MouseEventArgs e)
{
string _selectedline = ""
System.Diagnostics.Process.Start(_selectedline);
}
--EDIT--
Related Solved Previous Thread
http://www.c-sharpcorner.com/Forums/Thread/219731/how-to-display-a-list-of-files-in-a-folder-in-a-text-box.aspx
Loading
VulpesPosted Jul 21, 2013, 5:14 PM
This line in your previous thread:
can then be changed to:
listBox1.DataSource = fileNames;
and your MouseDoubleClick event for the ListBox will become:
thiago costaPosted Jul 21, 2013, 5:41 PM
VulpesPosted Jul 21, 2013, 5:39 PM
thiago costaPosted Jul 21, 2013, 5:37 PM
I will be trying that list box soon.
But, is there another way to get the selected line string value, other than the method I used ?
Thanks again man
VulpesPosted Jul 21, 2013, 5:33 PM
Compared to a multi-line textbox, they are automatically read only, so the user can't mess up the display.
Whilst you can set the textbox to read-only, this grays out the background which doesn't look too good IMO.
Also as long as the SelectionMode is set to One (the default), the user can only choose one item at a time from the listbox.
With the multi-line textbox, the user can select any amount of text which could result in an exception here.
thiago costaPosted Jul 21, 2013, 5:21 PM
Thank you I will try it.
My brother started a small appliance repair business, and I am helping him keep track of his parts inventory behind his truck lol, I am doing it the noob way because I am a noob, :D.
But I will try the list box..
I am attaching a copy of the project if you want to check it out :D
It's functional for now.
thiago costaPosted Jul 21, 2013, 5:01 PM
This worked:
It worked because when you double click it selects the line. Not exactly how I wanted it to work, but it works I guess !
But I am still interested on how to get the string value of a selected line so I can do more with it in the future, thanks guys.