Page 1 of 1
Using tooltips and listboxes
Posted: Sat Aug 21, 2010 12:02 am
by GoodGuy17
Hello,
I am using a listbox control, and I want the user to see the name of the song when the mouse is hovered over an item. In the listbox, it has the full directory for ease of playing the music on click event. Can somebody either tell me how to show the name of the song in a run-time-made tooltip or tell me how I could use the Listview to show the name and directory. Note with the listview I would need to know how to make Player.URL = Listview1.SelectedItem work.
Thanks.
~GoodGuy17

Re: Using tooltips and listboxes
Posted: Sat Aug 21, 2010 5:19 pm
by GoodGuy17
BUMP.
Re: Using tooltips and listboxes
Posted: Sat Aug 21, 2010 5:26 pm
by Codex
i dont get what you mean. so i cant help you unless you explain.
Re: Using tooltips and listboxes
Posted: Sat Aug 21, 2010 5:43 pm
by GoodGuy17
I am using a listbox.
Everytime I click Add Song, I navigate to a song, and add it to the listbox.
I want to see the name of the song, instead of the file location, when I hover the mouse over the location. If you can't do that, I could use a ListView and put the name under a column.
Re: Using tooltips and listboxes
Posted: Sat Aug 21, 2010 5:53 pm
by Codex
Ok, now for the part where u take the name, u could use : listbox.items.add(OpenFileDialog1.SafeFileNames)
Re: Using tooltips and listboxes
Posted: Sat Aug 21, 2010 6:12 pm
by GoodGuy17
No I need the name of the song. Like If I get C:\BLABLABLA\Song.wav I want Song.wav to show up in a tooltip.
Re: Using tooltips and listboxes
Posted: Sat Aug 21, 2010 6:21 pm
by mandai
Code: Select all Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
ToolTip1.RemoveAll()
ToolTip1.SetToolTip(ListBox1, Path.GetFileName(ListBox1.SelectedItem.ToString()))
End Sub
Re: Using tooltips and listboxes
Posted: Sat Aug 21, 2010 6:52 pm
by GoodGuy17
Thanks mandai.
Later in other help, can you tell people what to import because if someone was new to vb and you gave them a code like this they would come back saying it doesnt work since they didnt import System.IO