VB Help - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: VB Help (/showthread.php?tid=46648)
VB Help by DJeX on 06-21-2005 at 04:46 PM
Ok I've been going at this for about an hour now and it's driveing me nuts. So I'll ask here.
I want to be able to search text on a selected listview item and if that text contains .mp3 then do bla bla. So this is what I got so far
If listFiles2.SelectedItems(0).Text = ".mp3" then
Bla bla bla
Now I know this will not work because thats saying that the text in the selected item is .mp3 then do bla bla bla, but what I really want is it to say If selected item text has .mp3 in it then do bla bla bla.
RE: VB Help by Mnjul on 06-21-2005 at 05:05 PM
Use InStr function:
If InStr(listFile2.SelectedItems(0).Text,".mp3")<>0 Then
blah blah blah
End If
When InStr returns 0, it means listFile2.SelectedItems(0).Text does not contain ".mp3".
RE: VB Help by DJeX on 06-21-2005 at 05:16 PM
Thanks man it worked great!
Now maybe you could help me include WMP in my program
I can't seem to get the the controls by useing WMP.controls.play() or any other control. I'm useing the new WMP 10 dll so i'm not to sure.
RE: VB Help by matty on 06-21-2005 at 05:32 PM
code: WMP.Controls.play
RE: VB Help by DJeX on 06-21-2005 at 05:43 PM
gee I thought I said that dident work.....
That will only work for the old versions of WMP.
RE: VB Help by RaceProUK on 06-21-2005 at 07:10 PM
quote: Originally posted by Mnjul
Use InStr function:
If InStr(listFile2.SelectedItems(0).Text,".mp3")<>0 Then
blah blah blah
End If
When InStr returns 0, it means listFile2.SelectedItems(0).Text does not contain ".mp3".
I'd recommend using Right$() to get the last 3-4 characters and compare with that.
If it's filenames of course.
RE: VB Help by Mike on 06-21-2005 at 07:24 PM
For playing music, I would recommend using the mciSendString API.
Example:
code: Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, _
Optional ByVal lpstrReturnString As String = 0, _
Optional ByVal uReturnLength As Long = 0, _
Optional ByVal hwndCallback As Long = 0) As Long
Private Sub Form_Load()
mciSendString "open """ & "C:\test.mp3" & """ type MPEGvideo alias PutWhatYouWantHere ", ByVal 0&, 0, ByVal 0&
mciSendString "play PutWhatYouWantHere", ByVal 0&, 0, ByVal 0&
End Sub
Private Sub Form_Unload()
mciSendString "close PutWhatYouWantHere", ByVal 0&, 0, ByVal 0&
End Sub
[/code]Note: All "PutWhatYouWantHere" must be same or, it wont work!
|