|
I explained yesterday why that code was wrong, and how it should be changed. It seems you have no interest in actually trying to write the correct code.
|
|
|
|
|
I am probably jumping into a rabbit hole here...
@Member Alienoiz, as per most posters above, you need to understand the code and it's operations that you got from another source. I agree that you do not have to re-invent the wheel but you need to understand why the wheel were invented and why/what it's function is before you can implement it into a real world scenario - you will not attach a wheel to a kettle but you might attach it to a car.
That being said, the following is some good practices to follow, which you probably would have done if you understood the code completely. I have used your class post from above, an answer to your 'listbox only updating item 1' will follow after -
Here are a few few suggestions for improving your code's efficiency and readability so anybody can understand it.
1. Make use of conventional naming practice's i.e 'Button1' can be named 'btn_Load_folder' which will point anyone else reading your code to your LoadFolder function. No-one will know what Button1, Label7, Text9 etc. do without going to the actual control to try and figure out what it's function is.
2. Remove unused imports such as System.Net.Security, System.Net.WebRequestMethods, System.Runtime, and System.Security.Cryptography. Including these unnecessary imports can clutter the code and affect your app's performance.
3. It's good practice to use explicit access modifiers i.e, Private, Public for your methods and variables. Not using an access modifier will always default to Private, it is however better to be explicit to improve your code readability.
4. You are repeating certain code over and over. In your Button1_Click and Button2_Click event handlers, you have duplicate code for retrieving the file names and populating the ListBox1 control. You should consider extracting this code into a separate method and calling it from both event handlers to avoid redundancy.
5. Combine event handlers into one event. Your event handlers for Button4_Click, Button6_Click, Button8_Click, and Button12_Click have similar code. You can combine them into a single event handler and determine the action or the expected behavior's based on the sender's ID etc.
6. Use 'Try...Catch' blocks instead of 'On Error Resume Next' to handle exceptions. By resuming next you just ignore the error and hope for the best, which is probably why you kept on stating that your code "works fine" whil;st it actually does not, you just skipped the errors. Using the 'Try...Catch' blocks allows you to handle specific exceptions and provide appropriate error messages or take necessary actions so your app does not crash somewhere along the line.
7. In some places, you read, write, move, or delete files within a loop or repeatedly. Consider combining these operations by making less calls to file system operations or you can use bulk operations where possible.
8. You have multiple places where you update the labels' text in your code. Rather combine this functionality into a separate method to avoid code duplication and improve maintainability with less stress on your app.
Below is the code for your class and it's methods. I suggest that you work through each line, let Google be your friend here and research each item that you do not understand. I do not claim this to be the best code, there might be better practice's but I am confident this will point you in the right direction to start learning why a wheel goes on a car and not a kettle -
Imports System.IO
Imports HundredMilesSoftware.UltraID3Lib
Public Class Form1
Dim myMp3 As New UltraID3()
' Event handler for loading files from a folder
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click, Button2.Click
Dim isLoadFolder As Boolean = (sender Is Button1)
Dim selectedPath As String = FolderBrowserDialog1.SelectedPath
If isLoadFolder Then
' Show the folder browser dialog to select a folder
If FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then
selectedPath = FolderBrowserDialog1.SelectedPath
Else
Return
End If
End If
ListBox1.Items.Clear()
' Get all the .mp3 files in the selected folder
Dim fileNames = Directory.GetFiles(selectedPath, "*.mp3", SearchOption.TopDirectoryOnly)
' Add the file names to the list box
For Each fileName As String In fileNames
Dim result As String = Path.GetFileName(fileName)
ListBox1.Items.Add(result)
Next
' Reset the label values
ResetLabelValues()
End Sub
' Event handler for selecting a file in the list box
Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
If ListBox1.SelectedItem Is Nothing Then Return
' Read the selected MP3 file using UltraID3
myMp3.Read(Path.Combine(FolderBrowserDialog1.SelectedPath, ListBox1.SelectedItem.ToString()))
' Update the labels with the ID3 tag information
Label1.Text = "Title: " & myMp3.ID3v2Tag.Title
Label2.Text = "Artist: " & myMp3.ID3v2Tag.Artist
Label3.Text = "Album: " & myMp3.ID3v2Tag.Album
Label4.Text = "Year: " & myMp3.ID3v2Tag.Year.ToString()
Label5.Text = "Track: " & myMp3.ID3v2Tag.TrackNum.ToString()
Label6.Text = "Comment: " & myMp3.ID3v2Tag.Comments
Label7.Text = "Genre: " & myMp3.ID3v2Tag.Genre
' Update the picture box with the album art if available
Dim pics = myMp3.ID3v2Tag.Frames.GetFrames(CommonMultipleInstanceID3v2FrameTypes.Picture)
If pics.Length > 0 Then
PictureBox1.Image = CType(pics(0), ID3v2PictureFrame).Picture
End If
End Sub
' Event handler for saving the edited tags to the MP3 file
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
If ListBox1.SelectedItem Is Nothing Then
MessageBox.Show(Me, "No File Selected!", "Select Files", MessageBoxButtons.OK)
Return
End If
' Check if any of the tag checkboxes are checked
Dim anyCheckBoxChecked = CheckBox1.Checked OrElse CheckBox2.Checked OrElse CheckBox3.Checked OrElse
(CheckBox4.Checked AndAlso Not String.IsNullOrEmpty(TextBox4.Text)) OrElse
(CheckBox5.Checked AndAlso Not String.IsNullOrEmpty(TextBox5.Text)) OrElse
CheckBox6.Checked OrElse CheckBox7.Checked
If Not anyCheckBoxChecked Then
MessageBox.Show(Me, "Select a tag to enter!", "Select Tags", MessageBoxButtons.OK)
Return
End If
' Update the ID3 tags based on the checkbox values
If CheckBox1.Checked Then
myMp3.ID3v2Tag.Title = TextBox1.Text
End If
If CheckBox2.Checked Then
myMp3.ID3v2Tag.Artist = TextBox2.Text
End If
If CheckBox3.Checked Then
myMp3.ID3v2Tag.Album = TextBox3.Text
End If
If CheckBox4.Checked AndAlso Not String.IsNullOrEmpty(TextBox4.Text) Then
Short.TryParse(TextBox4.Text, myMp3.ID3v2Tag.Year)
End If
If CheckBox5.Checked AndAlso Not String.IsNullOrEmpty(TextBox5.Text) Then
Short.TryParse(TextBox5.Text, myMp3.ID3v2Tag.TrackNum)
End If
If CheckBox6.Checked Then
myMp3.ID3v2Tag.Comments = TextBox6.Text
End If
If CheckBox7.Checked Then
myMp3.ID3v2Tag.Genre = If(ComboBox1.Text = "01 - User", TextBox7.Text, ComboBox1.Text)
End If
' Write the changes to the MP3 file
myMp3.Write()
' Show operation complete message
MessageBox.Show(Me, "Operation Complete!", "Tagged Files!", MessageBoxButtons.OK)
End Sub
' Event handler for clearing the list box
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click, Button8.Click
ListBox1.Items.Clear()
End Sub
' Event handler for handling key press events in TextBox5 and TextBox4
' Only allows digits and backspace to be entered
Private Sub TextBox5_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox5.KeyPress, TextBox4.KeyPress
Dim ch As Char = e.KeyChar
If Not Char.IsDigit(ch) AndAlso Asc(ch) <> 8 Then
e.Handled = True
End If
End Sub
' Event handler for renaming the selected file
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
If ListBox1.SelectedItem Is Nothing Then
MessageBox.Show(Me, "No File Selected!", "Select Files", MessageBoxButtons.OK)
Return
End If
' Rename the selected file
My.Computer.FileSystem.RenameFile(Path.Combine(FolderBrowserDialog1.SelectedPath, ListBox1.SelectedItem.ToString()), TextBox8.Text & ".mp3")
' Refresh the list box
RefreshListBox()
End Sub
' Event handler for moving the selected file to a different folder
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
If ListBox1.SelectedItem Is Nothing Then
MessageBox.Show(Me, "No File Selected!", "Select Files", MessageBoxButtons.OK)
Return
End If
Dim selectedFilePath As String = Path.Combine(FolderBrowserDialog1.SelectedPath, ListBox1.SelectedItem.ToString())
Dim destinationFilePath As String = Path.Combine(TextBox9.Text, ListBox1.SelectedItem.ToString())
' Check if the destination file already exists
If File.Exists(destinationFilePath) Then
MessageBox.Show(Me, "File Exists!", "Duplicated Files!", MessageBoxButtons.OK)
Return
End If
' Move the file to the destination folder
My.Computer.FileSystem.MoveFile(selectedFilePath, destinationFilePath)
' Refresh the list box
RefreshListBox()
End Sub
' Event handler for copying the selected file to a different folder
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
If ListBox1.SelectedItem Is Nothing Then
MessageBox.Show(Me, "No File Selected!", "Select Files", MessageBoxButtons.OK)
Return
End If
Dim selectedFilePath As String = Path.Combine(FolderBrowserDialog1.SelectedPath, ListBox1.SelectedItem.ToString())
Dim destinationFilePath As String = Path.Combine(TextBox10.Text, ListBox1.SelectedItem.ToString())
' Check if the destination file already exists
If File.Exists(destinationFilePath) Then
MessageBox.Show(Me, "File Exists!", "Duplicated Files!", MessageBoxButtons.OK)
Return
End If
' Copy the file to the destination folder
My.Computer.FileSystem.CopyFile(selectedFilePath, destinationFilePath, overwrite:=False)
' Refresh the list box
RefreshListBox()
End Sub
' Event handler for selecting the destination folder for move operation
Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
If FolderBrowserDialog2.ShowDialog() = DialogResult.OK Then
TextBox9.Text = FolderBrowserDialog2.SelectedPath
End If
End Sub
' Event handler for selecting the destination folder for copy operation
Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
If FolderBrowserDialog3.ShowDialog() = DialogResult.OK Then
TextBox10.Text = FolderBrowserDialog3.SelectedPath
End If
End Sub
' Event handler for selecting a new album art image
Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
Dim ofd As New OpenFileDialog()
If ofd.ShowDialog() = DialogResult.OK Then
If Not String.IsNullOrEmpty(ofd.FileName) Then
PictureBox1.Image = Bitmap.FromFile(ofd.FileName)
End If
End If
End Sub
' Event handler for deleting selected files
Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
For i As Integer = ListBox1.SelectedIndices.Count - 1 To 0 Step -1
ListBox1.Items.RemoveAt(ListBox1.SelectedIndices(i))
Next
End Sub
' Event handler for filtering the list box based on the search text
Private Sub TextBox11_TextChanged(sender As Object, e As EventArgs) Handles TextBox11.TextChanged
RefreshListBox()
End Sub
' Event handler for toggling between mass edit and single edit mode
Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
If Button13.Text = "Mass Edit" Then
Button13.Text = "Single Edit"
Else
Button13.Text = "Mass Edit"
End If
ToggleFileActionButtons()
ToggleSelectionMode()
End Sub
' Helper method to reset the label values
Private Sub ResetLabelValues()
Label1.Text = "Title:"
Label2.Text = "Artist:"
Label3.Text = "Album:"
Label4.Text = "Year:"
Label5.Text = "Track:"
Label6.Text = "Comment:"
Label7.Text = "Genre:"
PictureBox1.Image = Nothing
End Sub
' Helper method to refresh the list box
Private Sub RefreshListBox()
Dim selectedPath As String = FolderBrowserDialog1.SelectedPath
ListBox1.Items.Clear()
If Not String.IsNullOrEmpty(selectedPath) Then
Dim fileNames = Directory.GetFiles(selectedPath, "*.mp3", SearchOption.TopDirectoryOnly)
For Each fileName As String In fileNames
Dim result As String = Path.GetFileName(fileName)
ListBox1.Items.Add(result)
Next
End If
ResetLabelValues()
End Sub
' Helper method to toggle the enabled state of file action buttons
Private Sub ToggleFileActionButtons()
Button5.Enabled = Not Button5.Enabled
Button6.Enabled = Not Button6.Enabled
Button7.Enabled = Not Button7.Enabled
Button8.Enabled = Not Button8.Enabled
End Sub
' Helper method to toggle the selection mode of the list box
Private Sub ToggleSelectionMode()
If ListBox1.SelectionMode = SelectionMode.One Then
ListBox1.SelectionMode = SelectionMode.MultiExtended
Else
ListBox1.SelectionMode = SelectionMode.One
End If
End Sub
End Class
Now, to your original problem where only the first item in your listbox is updated. This is because your 'myMp3.Write()' method inside the loop. This causes the changes to be written to the MP3 file immediately after each update. You need to move the 'myMp3.Write()' method outside the loop -
Dim items = ListBox1.SelectedItems
For Each item In items
If CheckBox1.Checked = True Then
myMp3.ID3v2Tag.Title = TextBox1.Text
End If
If CheckBox2.Checked = True Then
myMp3.ID3v2Tag.Artist = TextBox2.Text
End If
If CheckBox3.Checked = True Then
myMp3.ID3v2Tag.Album = TextBox3.Text
End If
If CheckBox4.Checked = True And TextBox4.Text <> "" Then
On Error Resume Next
myMp3.ID3v2Tag.Year = Short.Parse(TextBox4.Text)
On Error Resume Next
End If
If CheckBox5.Checked = True And TextBox5.Text <> "" Then
myMp3.ID3v2Tag.TrackNum = Short.Parse(TextBox5.Text)
End If
If CheckBox6.Checked = True Then
myMp3.ID3v2Tag.Comments = TextBox6.Text
End If
If CheckBox7.Checked = True Then
If ComboBox1.Text = "01 - User" Then
myMp3.ID3v2Tag.Genre = TextBox7.Text
Else
myMp3.ID3v2Tag.Genre = ComboBox1.Text
End If
End If
' Write the changes to the MP3 file
myMp3.Write()
Next
Last but not least, I could not see 1 poster that tried to help you show arrogance or attacking your methods, rather I saw them offering help but you insisted that you are not willing to learn or accept criticism to enable you to become a better developer. Rather sit back, swallow your pride and accept their answers or direction and I promise you taht you will become a top notch coder!
|
|
|
|
|
@Andre Hi..thanks..im still not alble to make the listbox mass edit..i must use the myMp3.Write() in each condition statement so tthat it writes only the selected tags one by one...
This is what im trying
<pre>Dim fils = ListBox1.SelectedItems
For Each item In fils
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()
End If
If CheckBox5.Checked = True And TextBox5.Text <> "" Then
On Error Resume Next
myMp3.ID3v2Tag.TrackNum = Short.Parse(TextBox5.Text)
myMp3.Write()
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
i also tried:
<pre>Dim fils = ListBox1.SelectedItems
For Each item In fils
myMp3.Read(FolderBrowserDialog1.SelectedPath & "\" & ListBox1.SelectedItem)
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()
End If
If CheckBox5.Checked = True And TextBox5.Text <> "" Then
On Error Resume Next
myMp3.ID3v2Tag.TrackNum = Short.Parse(TextBox5.Text)
myMp3.Write()
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
|
|
|
|
|
Show the code that your 'myMp3.Write()' function expects when you write to it.
|
|
|
|
|
Hi...sorry for the late reply...i think what you want is this
myMp3.ID3v2Tag.Title = TextBox1.Text
myMp3.Write()
This is what i do..if:
i put this in the beginning of the code
Public Class Form1
Dim myMp3 As New UltraID3()
then use this to open and list the files:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then
ListBox1.Items.Clear()
Dim fileNames = My.Computer.FileSystem.GetFiles(FolderBrowserDialog1.SelectedPath, FileIO.SearchOption.SearchTopLevelOnly, "*.mp3")
For Each fileName As String In fileNames
Dim result As String = Path.GetFileName(fileName)
ListBox1.Items.Add(result)
Next
End If
Label1.Text = "Title :"
Label2.Text = "Artist :"
Label3.Text = "Album :"
Label4.Text = "Year :"
Label5.Text = "Track :"
Label6.Text = "Comment :"
Label7.Text = "Genre : "
End Sub
then this to read and extract the tags into the labels text:
<pre> Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
If ListBox1.SelectedItem = "" Then
On Error Resume Next
Else
myMp3.Read(FolderBrowserDialog1.SelectedPath & "\" & ListBox1.SelectedItem)
Label1.Text = "Title : " & myMp3.ID3v2Tag.Title
Label2.Text = "Artist : " & myMp3.ID3v2Tag.Artist
Label3.Text = "Album : " & myMp3.ID3v2Tag.Album
Label4.Text = "Year : " & myMp3.ID3v2Tag.Year.ToString
Label5.Text = "Track : " & myMp3.ID3v2Tag.TrackNum.ToString
Label6.Text = "Comment : " & myMp3.ID3v2Tag.Comments
Label7.Text = "Genre : " & myMp3.ID3v2Tag.Genre
On Error Resume Next
Dim pics = myMp3.ID3v2Tag.Frames.GetFrames(CommonMultipleInstanceID3v2FrameTypes.Picture)
PictureBox1.Image = CType(pics(0), ID3v2PictureFrame).Picture
End If
End Sub
and finally this code to write from textboxes into the file:
<pre>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 And CheckBox8.Checked = False Then
Dim r8 As DialogResult = MessageBox.Show(Me, "Select a tag to enter!",
"Select Tags", MessageBoxButtons.OK)
Else
Dim fils = ListBox1.SelectedItems
For Each item In fils
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()
End If
If CheckBox5.Checked = True And TextBox5.Text <> "" Then
On Error Resume Next
myMp3.ID3v2Tag.TrackNum = Short.Parse(TextBox5.Text)
myMp3.Write()
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
End If
Dim r9 As DialogResult = MessageBox.Show(Me, "Operation Complete!",
"Tagged Files!", MessageBoxButtons.OK)
End If
End Sub
The thing LOADS and SAVES MP3 TAGs!!
i understand what the code does but im not able to generate it all...im more of a decoder then what i have from coder lo0l
|
|
|
|
|
OK ... and where is the requested code from 'myMp3.Write()' ?
|
|
|
|
|
I dont know what you mean...but does it requests: myMp3.ID3v2Tag.Title ...? For example
|
|
|
|
|
No ... what I mean is this :
myMp3.ID3v2Tag.Title = TextBox1.Text
myMp3.Write()
There is the call for the write ... and what I want to see is the code of that method ... that can't be so difficult ...
|
|
|
|
|
I do not know...im using a dll library...how shall i look? Sorry
|
|
|
|
|
If it is like allready mentioned and you are using a Library ... you don't have the Source-Code from it ?
It is impossible to help if you are not helping ... the mistake (i suppose) is how you use this Library ...
|
|
|
|
|
Also waiting for the requested '.Write'.
|
|
|
|
|
It's part of the third party library he is using. Questions like this just go straight over his head. His programming skills are mainly: Copy, Paste and Guess.
|
|
|
|
|
I suppose you are right ... but doesn't makes it better ...
|
|
|
|
|
If you really want to know, then read this entire thread. Alternatively find something interesting to waste your time on.
|
|
|
|
|
Yes im using the UltraID3lib library...i cannot access its code? Or...how do i do it?
Guys...about my knowledge..i have a book called Visual Basic 6 - Advanced Tecnichs with API...i have read the book and made a lot of small apps during "the day"...now my book is obsolete almost because of VB.Net being different..anyway..i learned all with that book and no more outside help...im trying to get back a little to VB just to excercise my mind...and..create a small application to give away in my website..
I code in SynthEdit some Virtual Synthesizers using a Visual Programming language..i also do all my website coding..
...and im no pro in none of these...but..i normally can achieve what i look for..
just for you to know my website: [DELETED]
|
|
|
|
|
I removed the URL to prevent you being tagged as a spammer (and it was that close whether I let it through without the URL or tagged it and you as spam) which would mean the BanHammer starts swinging. Please don't post it again, others are rather more trigger happy than I.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OK...thank you for not banning me
|
|
|
|
|
Oops ... I have done that ...
What kind of answer did you got from the OP that it is flagged as (I suppose) abusive ?
|
|
|
|
|
I need to say something that will make you laugh the rest of the day...
i was makin a .NET app...not an .NET Framework...how did i error this?!! lo0l
I already passed all code into a .NET Framework application
Sorry..if does matter?!!
|
|
|
|
|
Okay ... to be able to understand the problem YOU must understand how the Framework you are using is working.
I suppose that your problem comes from not using this Framework in the right way.
I, myself, don't like to use 3rd party products from which I don't know how to work with. Mostly it is easier (for me) to create it by myself ...
|
|
|
|
|
No, none of it is abusive. Just that he is copying stuff from the internet, and his understanding of what he copies, and general programming is not too good.
|
|
|
|
|
Message Closed
modified 15-Jun-23 8:16am.
|
|
|
|
|
I don't think you meant this message for me Andre.
|
|
|
|
|
Oops, no sorry. Will repost under the correct tab...
|
|
|
|
|
hey..i was able to do it...i used this code
<pre>Private Sub lblsave_Click(sender As Object, e As EventArgs) Handles lblsave.Click
If ListBox1.SelectedItem = "" Then
Dim r8 As DialogResult = MessageBox.Show(Me, "No file selected!",
"Select files!", MessageBoxButtons.OK)
Else
Dim rw As DialogResult = MessageBox.Show(Me, "SAVE all TAGs?",
"Save tags!", MessageBoxButtons.OKCancel)
If rw = DialogResult.OK Then
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 And CheckBox8.Checked = False Then
Dim r8 As DialogResult = MessageBox.Show(Me, "Select a tag to enter!",
"Select tags!", MessageBoxButtons.OK)
Else
Dim ite = ListBox1.SelectedItems
For Each item In ite
myMp3.Read(FolderBrowserDialog1.SelectedPath & "\" & item)
If CheckBox1.Checked = True Then
myMp3.ID3v2Tag.Title = label1.Text
myMp3.Write()
End If
If CheckBox2.Checked = True Then
myMp3.ID3v2Tag.Artist = Label2.Text
myMp3.Write()
End If
If CheckBox3.Checked = True Then
myMp3.ID3v2Tag.Album = Label3.Text
myMp3.Write()
End If
If CheckBox4.Checked = True And Label4.Text <> "" Then
On Error Resume Next
myMp3.ID3v2Tag.Year = Short.Parse(Label4.Text)
myMp3.Write()
End If
If CheckBox5.Checked = True And label5.Text <> "" Then
On Error Resume Next
myMp3.ID3v2Tag.TrackNum = Short.Parse(label5.Text)
myMp3.Write()
End If
If CheckBox6.Checked = True Then
myMp3.ID3v2Tag.Comments = label6.Text
myMp3.Write()
End If
If CheckBox7.Checked = True Then
myMp3.ID3v2Tag.Genre = label7.Text
myMp3.Write()
End If
If CheckBox8.Checked = True Then
If label10.Text <> "" Then
Dim pics = myMp3.ID3v2Tag.Frames.GetFrames(CommonMultipleInstanceID3v2FrameTypes.Picture)
myMp3.ID3v2Tag.Frames.Remove(pics)
myMp3.Write()
Dim AlbumArt As ID3v2PictureFrame = New ID3v23PictureFrame(CType(System.Drawing.Bitmap.FromFile(label10.Text), System.Drawing.Bitmap), PictureTypes.CoverFront, "Attached picture", TextEncodingTypes.ISO88591)
myMp3.ID3v2Tag.Frames.Add(AlbumArt)
myMp3.Write()
Else
Dim re As DialogResult = MessageBox.Show(Me, "Could not write image!",
"Tagged files!", MessageBoxButtons.OK)
End If
End If
Next item
End If
End If
End If
Dim r9 As DialogResult = MessageBox.Show(Me, "Operation complete!",
"Tagged files!", MessageBoxButtons.OK)
End Sub
|
|
|
|
|