Reading MP3 FileName?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Aleksandar Djurdjevic
    New Member
    • Apr 2007
    • 11

    Reading MP3 FileName?

    Hello

    I made small mp3 player in VB.NET Express Edition..but i don't know how to
    read mp3 filename in Label..for example...i load mp3 by OpenFileDialog. .the music starts and filename of that mp3 is shown in Label..

    greetings
  • SammyB
    Recognized Expert Contributor
    • Mar 2007
    • 807

    #2
    Originally posted by Aleksandar Djurdjevic
    Hello

    I made small mp3 player in VB.NET Express Edition..but i don't know how to
    read mp3 filename in Label..for example...i load mp3 by OpenFileDialog. .the music starts and filename of that mp3 is shown in Label..

    greetings
    [size=2]Label1.Text = OpenFileDialog1 .FileName

    [/size]

    Comment

    • SammyB
      Recognized Expert Contributor
      • Mar 2007
      • 807

      #3
      Originally posted by SammyB
      [size=2]Label1.Text = OpenFileDialog1 .FileName

      [/size]
      Ignore the size stuff. It should be:

      Label1.Text = OpenFileDialog1 .FileName

      Comment

      • channaJ
        New Member
        • Mar 2007
        • 67

        #4
        Originally posted by Aleksandar Djurdjevic
        Hello

        I made small mp3 player in VB.NET Express Edition..but i don't know how to
        read mp3 filename in Label..for example...i load mp3 by OpenFileDialog. .the music starts and filename of that mp3 is shown in Label..

        greetings
        And if you want to take the full path of the file, use..

        Code:
        Label1.Text = OpenFileDialog.PostedFile.Name;

        Comment

        • Aleksandar Djurdjevic
          New Member
          • Apr 2007
          • 11

          #5
          OK,i will try those...thank you..

          Comment

          • Aleksandar Djurdjevic
            New Member
            • Apr 2007
            • 11

            #6
            @SammyB

            I tried to use OpenFileDialog1 .FileName,but it returns full path of the file.
            i want only filename without full path..i use vb.net express edition with
            .NET Framework 2.0..

            Comment

            • SammyB
              Recognized Expert Contributor
              • Mar 2007
              • 807

              #7
              Originally posted by Aleksandar Djurdjevic
              @SammyB

              I tried to use OpenFileDialog1 .FileName,but it returns full path of the file.
              i want only filename without full path..i use vb.net express edition with
              .NET Framework 2.0..
              Use FileInfo:
              Code:
              Dim f As System.IO.FileInfo
              f = My.Computer.FileSystem.GetFileInfo (OpenFileDialog1.FileName)
              MsgBox(f.Name)
              MsgBox(Strings.Replace(f.Name, f.Extension, ""))

              Comment

              • sekshin8
                New Member
                • Apr 2007
                • 4

                #8
                I think you can use something like this too:

                FileName = PathName.Substr ing(PathName.La stIndexOf("/") - 1)

                Comment

                • Aleksandar Djurdjevic
                  New Member
                  • Apr 2007
                  • 11

                  #9
                  Thanks for replying guys...i have found some simple function that do the job.. here it is:

                  Public Function FileNameWithout Path(ByVal FullPath As String) As String
                  Return System.IO.Path. GetFileName(Ful lPath)
                  End Function

                  greets

                  Comment

                  Working...