|
You are trying to store the text strings into both those fields which are (presumably) byte types. So you need to convert the strings into their correct value types first. As someone who claims not to be a programmer, that is a lot of code that you have written.
|
|
|
|
|
Thanks...i use a lot of snippets too....so how do i convert them properly?..i already tried some methods but i could not do it!
anyway..the code is functionning for pre-tagged files...i just cannot write the properties into new files
|
|
|
|
|
I don't know how you convert them because I am not clear on what type the target is. So you need to check the definition of those fields and use an appropriate method of the Convert Class (System) | Microsoft Learn[^].
|
|
|
|
|
well..they are just the Track ID and Genre ID in an mp3 file...can i change the main code and switch them to string?...this is why i posted the full code on the start!!!
|
|
|
|
|
I don't know the answer. You first need to know what actual type they are in the file: Byte, String, Int32, Int64, Bool etc. You then need to set a matching type in your code. Then when you get the user's selection, you may or may not need to convert what the user chooses into the appropriate type. But all that detail should have been decided before you put all this code together. And I am afraid there is far too much for anyone other than you, to know where to do this.
|
|
|
|
|
i think i can do the conversion here:
Dim strTag As New String(" ", 3)
Dim strTitle As New String(" ", 30)
Dim strArtist As New String(" ", 30)
Dim strAlbum As New String(" ", 30)
Dim strYear As New String(" ", 4)
Dim strComment As New String(" ", 28)
Dim bytDummy As Byte
Dim bytTrack As Byte
Dim bytGenre As Byte
setting the "as byte" to "new string" but i do not know about the numbers here??!!!
|
|
|
|
|
As I said above, You need to match your definitions with the actual types that are used in the file. So you need to find the definition of the file types you are trying to modify and check the requirements.
|
|
|
|
|
i think is Int32
|
|
|
|
|
Fine, but you need to be certain.
|
|
|
|
|
i tried this but no luck:
If CheckBox5.Checked = True Then
Dim txt = TextBox5.Text
Dim tt As Integer = Convert.ToInt32(txt)
tt = objMP3V1.Frame(MP3ID3v1.FrameTypes.Track) & vbLf
objMP3V1.Update()
End If
If CheckBox6.Checked = True Then
objMP3V1.Frame(MP3ID3v1.FrameTypes.Comment) = TextBox6.Text
objMP3V1.Update()
End If
If CheckBox7.Checked = True Then
Dim xt = ComboBox1.SelectedValue
Dim xx As Integer = Convert.ToInt32(xt)
xx = objMP3V1.Frame(MP3ID3v1.FrameTypes.Genre) & vbLf
objMP3V1.Update()
End If
|
|
|
|
|
Member Alienoiz wrote: i tried this but no luck: Why are you trying to store 32 bit integer values in 8 bit byte fields?
|
|
|
|
|
well..,like i say..im no coder...i just read snippets and try by error!
|
|
|
|
|
can it be here?
' Fix the length of the frames
strTitle = LSet(mobjFrame(0), Len(strTitle))
strArtist = LSet(mobjFrame(1), Len(strArtist))
strAlbum = LSet(mobjFrame(2), Len(strAlbum))
strYear = LSet(mobjFrame(3), Len(strYear))
bytTrack = mobjFrame(4)
strComment = LSet(mobjFrame(5), Len(strComment))
bytGenre = mobjFrame(6)
sorry im blind about it for now (
|
|
|
|
|
Sorry, I really have no idea what that code is trying to do, so I cannnt say whether it is correct or not.
|
|
|
|
|
hey..i changed my library..im now using UltraID3lib.....it seems im making it but i have another question...
how do i make mass edit in a listbox?
im using this code that was working previously but is not working now:
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
If ListBox1.SelectedItem = "" Then
Dim r8 As DialogResult = MessageBox.Show(Me, "No File Selected!",
"Select Files", MessageBoxButtons.OK)
Else
If CheckBox1.Checked = False And CheckBox2.Checked = False And CheckBox3.Checked = False And CheckBox4.Checked = False And CheckBox5.Checked = False And CheckBox6.Checked = False And CheckBox7.Checked = False Then
Dim r8 As DialogResult = MessageBox.Show(Me, "Select a tag to enter!",
"Select Tags", MessageBoxButtons.OK)
Else
Dim fil = ListBox1.SelectedItems
Dim fil2 As String
For Each fil2 In fil
If CheckBox1.Checked = True Then
myMp3.ID3v2Tag.Title = TextBox1.Text
myMp3.Write()
End If
If CheckBox2.Checked = True Then
myMp3.ID3v2Tag.Artist = TextBox2.Text
myMp3.Write()
End If
If CheckBox3.Checked = True Then
myMp3.ID3v2Tag.Album = TextBox3.Text
myMp3.Write()
End If
If CheckBox4.Checked = True And TextBox4.Text <> "" Then
On Error Resume Next
myMp3.ID3v2Tag.Year = Short.Parse(TextBox4.Text)
myMp3.Write()
On Error Resume Next
End If
If CheckBox5.Checked = True And TextBox5.Text <> "" Then
myMp3.ID3v2Tag.TrackNum = Short.Parse(TextBox5.Text)
myMp3.Write()
On Error Resume Next
End If
If CheckBox6.Checked = True Then
myMp3.ID3v2Tag.Comments = TextBox6.Text
myMp3.Write()
End If
If CheckBox7.Checked = True Then
If ComboBox1.Text = "01 - User" Then
myMp3.ID3v2Tag.Genre = TextBox7.Text
myMp3.Write()
Else
myMp3.ID3v2Tag.Genre = ComboBox1.Text
myMp3.Write()
End If
End If
Next
Dim r9 As DialogResult = MessageBox.Show(Me, "Operation Complete!",
"Tagged Files!", MessageBoxButtons.OK)
End If
End If
can you help with this? thanks
|
|
|
|
|
Sorry, I have no idea what you mean by "this code that was working previously but is not working now:". You need to explain what happens when you run this code and why that is not correct. Alternatively, use the debugger to step through the code to try and find out what is going on.
|
|
|
|
|
well...i just want to apply this code
If CheckBox6.Checked = True Then
myMp3.ID3v2Tag.Comments = TextBox6.Text
myMp3.Write()
End If
If CheckBox7.Checked = True Then
If ComboBox1.Text = "01 - User" Then
myMp3.ID3v2Tag.Genre = TextBox7.Text
myMp3.Write()
Else
myMp3.ID3v2Tag.Genre = ComboBox1.Text
myMp3.Write()
End If
End If
........to all selected items in a listbox!!
|
|
|
|
|
|
i have been searching but i cannot find anything to use...could you gimme a help please?
|
|
|
|
|
No, because I have no idea what your problem is. You need to show the code you are using, and explain what the problem is and where it occurs.
|
|
|
|
|
OK...so i have a listbox with files (mp3) and im trying to edit the tags..i can do one by one but i do not know how to tag them all at once. i want to implement this code in all files of the listbox just by using a button.
<pre lang="VB"><pre>If CheckBox1.Checked = True Then
myMp3.ID3v2Tag.Title = TextBox1.Text
myMp3.Write()
End If
If CheckBox2.Checked = True Then
myMp3.ID3v2Tag.Artist = TextBox2.Text
myMp3.Write()
End If
If CheckBox3.Checked = True Then
myMp3.ID3v2Tag.Album = TextBox3.Text
myMp3.Write()
End If
If CheckBox4.Checked = True And TextBox4.Text <> "" Then
On Error Resume Next
myMp3.ID3v2Tag.Year = Short.Parse(TextBox4.Text)
myMp3.Write()
On Error Resume Next
End If
If CheckBox5.Checked = True And TextBox5.Text <> "" Then
myMp3.ID3v2Tag.TrackNum = Short.Parse(TextBox5.Text)
myMp3.Write()
On Error Resume Next
End If
If CheckBox6.Checked = True Then
myMp3.ID3v2Tag.Comments = TextBox6.Text
myMp3.Write()
End If
If CheckBox7.Checked = True Then
If ComboBox1.Text = "01 - User" Then
myMp3.ID3v2Tag.Genre = TextBox7.Text
myMp3.Write()
Else
myMp3.ID3v2Tag.Genre = ComboBox1.Text
myMp3.Write()
End If
If CheckBox8.Checked = True Then
End If
End If
|
|
|
|
|
You just need a couple of loops:
ForEach file in the ListBox
Open the file
ForEach CheckBox in the Form
adjust the tags as required
Next
Save and Close the updated file
Next
Put the code into a subroutine and pass it the list of filenames from the ListBox.
|
|
|
|
|
should be something like this right?
Dim items = ListBox1.SelectedItem()
For Each items In ListBox1.SelectedItems
If CheckBox1.Checked = True Then
myMp3.ID3v2Tag.Title = TextBox1.Text
myMp3.Write()
Next
End If
is not working ((
|
|
|
|
|
Your first two lines duplicate each other:
Dim items = ListBox1.SelectedItem() // get a list of the SelectedItem(s)
For Each items In ListBox1.SelectedItems // do the same, but duplicating the variable name
But either way they make little sense as you do not do anything with the item you pull from the ListBox.
You need something like:
For Each file As String In ListBox1.SelectedItems
Next
Try not to write all your code inline, as it makes it so much more dificult to read and, more importantly, to debug.
|
|
|
|
|
aaarrggghh...im not able to make it work ...could you be a little more explicit please?
|
|
|
|