rename listbox item
-
can anyone point me in the right direction on how to right click on a listbox entry and be able to rename it. my project logs video clips in 60 sec files and stores them in a folder, i use filesystemwatcher to populate a listbox of with the file names as they are created minute 1 minute 2 minute 3 and so on... i want to be able to select a file and rename it so i can find that bit of video quicker so far i got private void listBox1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) //not sure what to add here any help would be great using visual studio 2008 c# kenny
-
can anyone point me in the right direction on how to right click on a listbox entry and be able to rename it. my project logs video clips in 60 sec files and stores them in a folder, i use filesystemwatcher to populate a listbox of with the file names as they are created minute 1 minute 2 minute 3 and so on... i want to be able to select a file and rename it so i can find that bit of video quicker so far i got private void listBox1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) //not sure what to add here any help would be great using visual studio 2008 c# kenny
Hi, 1. why use MouseDown? I would set SelectionMode.One, then use SelectedIndexChanged event and SelectedIndex property. Don't forget to check for >=0. Or better yet, use DoubleClick event, so user must double click to enter rename mode. 2. how will you enter the new name? just typing at the ListBox? trough a TextBox? and when do you want to rename? on hitting Enter? clicking a Button? :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
[The QA section does it automatically now, I hope we soon get it on regular forums as well]
-
Hi, 1. why use MouseDown? I would set SelectionMode.One, then use SelectedIndexChanged event and SelectedIndex property. Don't forget to check for >=0. Or better yet, use DoubleClick event, so user must double click to enter rename mode. 2. how will you enter the new name? just typing at the ListBox? trough a TextBox? and when do you want to rename? on hitting Enter? clicking a Button? :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
[The QA section does it automatically now, I hope we soon get it on regular forums as well]
-
can anyone point me in the right direction on how to right click on a listbox entry and be able to rename it. my project logs video clips in 60 sec files and stores them in a folder, i use filesystemwatcher to populate a listbox of with the file names as they are created minute 1 minute 2 minute 3 and so on... i want to be able to select a file and rename it so i can find that bit of video quicker so far i got private void listBox1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) //not sure what to add here any help would be great using visual studio 2008 c# kenny
-
would like to enter new name by just typing at listbox, dont want to double click as i use that for playing the video file kenny
I would go with Scott's suggestion (context menu), hence use the SelectedIndexChanged event, and the KeyPress event. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
[The QA section does it automatically now, I hope we soon get it on regular forums as well]