Windows Develop Bookmark and Share   
 index > Windows Forms General > Loading a text file via openFileDialog into a listBox Part 2
 

Loading a text file via openFileDialog into a listBox Part 2

I'm looking for one final bit of functionality to my program.
Is it possible to program in a function key to enable the program to move down one line in the listBox and copy the line it moved down to? My goal here is to take out the tabbing back and forth all together for smooth operation in gaming and other environments.

So for example, if I'm within a MMORPG and doing role play, I would like to hit the F1 key to have the program move down to the next line of text in the listBox and copy it, so that all I would have to do is paste it within the game.

Thank you so much in advance, and I'll continue to try to figure it out till I see something here. :)
Pacem  Friday, September 25, 2009 3:30 PM
Hi Pacem,

Based on my understanding, you want to copy the ListBox selected item text into system clipboard. Before you do that, you want to select next item in the ListBox. If I understand it correct, I think you can use this way
listBox1.SelectedIndex = listBox1.SelectedIndex + 1;
Clipboard.SetText(listBox1.SelectedItem.ToString());

Hope this helps. If I misunderstood something, please feel free to tell me.

Sincerely,
Kira Qian
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework!
Kira Qian  Tuesday, September 29, 2009 7:38 AM
Hi Pacem,

Based on my understanding, you want to copy the ListBox selected item text into system clipboard. Before you do that, you want to select next item in the ListBox. If I understand it correct, I think you can use this way
listBox1.SelectedIndex = listBox1.SelectedIndex + 1;
Clipboard.SetText(listBox1.SelectedItem.ToString());

Hope this helps. If I misunderstood something, please feel free to tell me.

Sincerely,
Kira Qian
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework!
Kira Qian  Tuesday, September 29, 2009 7:38 AM

You can use google to search for other answers

Custom Search

More Threads

• Is OpenFile dialog available as a control?
• Display generated Bitmap object in a PictureBox
• VIDEO IN A FORM
• Create a progress bar of sorts
• how checkBox populates the listBox?
• Custom Control Library - Windows Forms
• RaiseEvent Skipped ?
• Setting the cursor doesn't work as expected
• Linklabel shortcut not working
• ToolStripTextBox Passwords?