Reviews, updates and in depth guides to your favourite mobile games - AppGamer.com
|
|
VB MP3 PLayer |
Page: 1 | Reply |
Jul 13th 2001 | #8433 Report |
Member since: Apr 16th 2001 Posts: 759 |
hey guys I am trying to make myself an Mp3 PLayer. no where as good as win amp or something but it is a start. problem whenever i try to compile it causes an error with the UBound statement and LBound. What is wrong (it is done in bold) i included all the code incase that was affecting it. ------------------------------------------------------------------ Option Explicit Dim GenresTypes Dim Min As Integer Dim Sec As Integer Dim FileName As String Dim FileOpen As Boolean Dim CurrentTag As TagInfo Private Type TagInfo Tag As String * 3 Songname As String * 30 artist As String * 30 album As String * 30 year As String * 4 comment As String * 30 genre As String * 1 End Type ----------------------------------------------------------- Private Sub cmdOpen_Click() With MediaPlayer1 If Not FileOpen Then .FileName = FileName .AutoStart = False .cmdOpen.Caption = "Close" Else .FileName = "" cmdOpen.Caption = "Open" End If End With End Sub -------------------------------------------------------------------------- Private Sub cmdWriteTag_Click() If FileOpen Then MsgBox "You can't save to an open file", _ vbCritical, "MP3 Tage Save Error" Exit Sub End If If Right(Dir1.Path, 1) = "\" Then FileName = Dir1.Path & File1.FileName Else FileName = Dir1.Path & "\" & File1.FileName End If With CurrentTag .Tag = "TAG" .Songname = txtTitle .artist = txtArtist .album = txtAlbum .year = txtYear .comment = txtComment .genre = Chr(Combo1.ListIndex + 1) Open FileName For Binary Access Write As #1 Seek #1, FileLen(FileName) - 127 Put #1, , .Tag Put #1, , .Songname Put #1, , .artist Put #1, , .album Put #1, , .year Put #1, , .comment Put #1, , .genre Close #1 End With End Sub -------------------------------------------------------------------------- Private Sub File1_Click() Dim temp As String On Error Resume Next EraseTXTBoxes If Right(Dir1.Path, 1) = "\" Then FileName = Dir1.Path & File1.FileName Else FileName = Dir1.Path & "\" & File1.FileName End If Open FileName For Binary As #1 With CurrentTag Get #1, FileLen(FileName) - 127, .Tag If Not .Tag = "TAG" Then lblMsg.Caption = "No tag" Close #1 Exit Sub End If Get #1, , .Songname Get #1, , .artist Get #1, , .album Get #1, , .year Get #1, , .comment Get #1, , .genre Close #1 txtTitle = RTrim(.Songname) txtArtist = RTrim(.artist) txtAlbum = RTrim(.album) txtYear = RTrim(.year) txtComment = RTrim(.comment) temp = RTrim(.genre) txtGenreCode = Asc(temp) Combo1.ListIndex = CInt(txtGenreCode) - 1 End With End Sub ---------------------------------------------------------------- Private Sub Dir1_change() File1.FileName = Dir1.Path End Sub -------------------------------------------------------------------------- Private Sub MediaPlayer1_OpenStateChange(ByVal OldState As Long, ByVal NewState As Long) Min = MediaPlayer1.Duration \ 60 Sec = MediaPlayer1.Duration - (Min * 60) lblTotalTime = "Total Time:" & Format(Min, "0#") _ & ":" & Format(Sec, "0#") 'format time to 00:00 FileOpen = CBool(NewState) End Sub -------------------------------------------------------------------------- Private Sub Timer1_Timer() Min = MediaPlayer1.CurrentPosition \ 60 Sec = MediaPlayer1.CurrentPosition - (Min * 60) If Min > 0 Or Sec > 0 Then lblElapsedTime = "Elapsed Time:" & Format(Min, "0#") _ & ":" & Format(Sec, "0#") Else lblElapsedTime = "Elapsed Time: 00:00" End If End Sub -------------------------------------------------------------------------- Private Sub EraseTXTBoxes() lblMsg.Caption = "" txtTitle = "" txtArtist = "" txtAlbum = "" txtYear = "" txtComment = "" txtGenreCode = "" Combo1.ListIndex = -1 End Sub Private Sub Form_Load() Dim x As Integer Dim iLower As Integer Dim iUpper As Integer Dim GenreTypes As Variant Drive1.Drive = "C:" Dir1.Path = "C:" GenreTypes = Array("Blues", "Classic Rock", "Country", _ "Dance", "Disco", "Funk", "Grunge", "Hip -Hop", _ "Jazz", "Metal", "New Age", "Oldies", "Other", _ "Pop", "R&b", "Rap", "Reggae", "Rock", "Techno", _ "Industrial", "Alternative", "Ska", "Death Metal", _ "Pranks", "Soundtrack", "Euro -Techno", "Ambient", _ "Trip -Hop", "Vocal", "Jazz Funk", "Fusion", _ "Trance", "Classical", "Instrumental") iLower = LBound(GenreTypes) iUpper = UBound(GenreTypes) For x = iLower To iUpper Combo1.AddItem GenreTypes(x) Next x End Sub |
Reply with Quote Reply |
Jul 13th 2001 | #8442 Report |
Member since: Mar 18th 2001 Posts: 1690 |
why are you using visual basic? Are you planning on porting this to a website?
|
Reply with Quote Reply |
Jul 13th 2001 | #8453 Report |
Member since: Mar 24th 2001 Posts: 3734 |
Prob because VB is about 132.7 times easier to learn than C
|
Reply with Quote Reply |
Jul 14th 2001 | #8460 Report |
Member since: Apr 16th 2001 Posts: 759 |
cause i am only 14 and i am learning VB now. ONce i have learnt that i will move onto another languuage. I am gonna be a programmer when i grow up. SO i am starting now. And i am trying to get better by making things so i learn it fluently.
|
Reply with Quote Reply |
Jul 14th 2001 | #8470 Report |
Member since: Mar 24th 2001 Posts: 3734 |
Good luck to ya' man. Programming sucks. If you like it, more power to you. I just don't like the idea of working 300 hour weeks. |
Reply with Quote Reply |
Jul 14th 2001 | #8479 Report |
Member since: Apr 16th 2001 Posts: 759 |
i do like it. And graphics. I am already ok at photoshop.
|
Reply with Quote Reply |
Jul 15th 2001 | #8603 Report |
Member since: Mar 18th 2001 Posts: 1690 |
I asked an honest question, gimme an honest answer. Vb is easy i s'ppose, But if I was doing something that I was planning on using in windows, I would definatly do it in C++. And C++ isnt as hard as you think to learn. |
Reply with Quote Reply |
Jul 16th 2001 | #8673 Report |
Member since: Apr 16th 2001 Posts: 759 |
Umm 0blivious dude are you talking to me. Cause if you are then here is my answer. I am learning VB first then i will learn C++ after i learn VB fluetnly. If you wanna be a good programmer you have to learn alot of languages ( or so i have been told ). the reason i made this was jsut to see if i could to test my VB abilities cause i have only been learning for 2 weeks now. If you were talking to MAtt then yeah.
|
Reply with Quote Reply |
Aug 6th 2001 | #11852 Report |
Member since: Aug 3rd 2001 Posts: 34 |
hmm, i think i see the problem...well, u never declared UBound, and LBound in the function...you have to define it there
|
Reply with Quote Reply |
Page: 1 | Back to top |
Please login or register above to post in this forum |
© Web Media Network Limited. All rights reserved. No part of this website may be reproduced without written permission. Photoshop is a registered trademark of Adobe Inc.. TeamPhotoshop.com is not associated in any way with Adobe, nor is an offical Photoshop website. |