Click here to Skip to main content
15,300,338 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello code project..
i was converted my mp3 file to bytearray and i decided to save it and in the next time i want to convert it again to mp3.

yet to convert my mp3 file to bytearray, i am using this code :

Dim bString As New System.Text.StringBuilder
Dim bArray As Byte() = IO.File.ReadAllBytes(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\a.mp3")
For Each b As Byte In bArray
RichTextBox1.Text = bString.ToString

but now how to convert bytearray in the RichTextBox1.Text to mp3 file again?
i am used this code but not work, mp3 file created but no sound :(

File.WriteAllText("C:\\a.mp3", RichTextBox1.Text)

thank you
Updated 25-Nov-13 19:57pm
Mehdi Gholam 26-Nov-13 2:33am
Why are you using a StringBuilder for byte data?
Of course. I answered...

1 solution

Forget string and text! The solution is seen with unarmed eye: if you used ReadAllBytes to read, apparently, you need to use WriteAllBytes to write:[^].

Mehdi Gholam 26-Nov-13 2:48am
Exactly! 5'ed
Thank you, Mehdi.
Gun Gun Febrianza 26-Nov-13 4:06am
thank you sir for help me :)
sorry iam late to reply your solution ..
Gun Gun Febrianza 26-Nov-13 4:10am
sorry iam late to reply.. hehe thankyou sir your link give me some solution :)
Sergey Alexandrovich Kryukov 26-Nov-13 11:18am
No problems with late or soon replies, ever. :-)
You are very welcome.
Good luck, call again.
Gun Gun Febrianza 26-Nov-13 5:21am
Dim data As Byte() = File.ReadAllBytes("C:\\a.mp3")
File.WriteAllBytes("C:\\a1.mp3", data)

hehe this what i want sir :)
Sergey Alexandrovich Kryukov 26-Nov-13 11:18am
Gun Gun Febrianza 22-Dec-13 5:22am
Dear Sergey i need your help :( here:
Sergey Alexandrovich Kryukov 22-Dec-13 12:16pm
Richard MacCutchan gave your the best answer so far. If you have something more specific, please ask.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900