SpookedOnion
New member
- Joined
- Aug 8, 2018
- Messages
- 2
- Programming Experience
- 1-3
Alright, so I'm trying to make a MP3 player that takes the videos from youtube turns them into MP3's and then it creates a button for every MP3 in a folder.
I have already finished on making all the MP3s export to a folder, and a button is made for every single mp3 in the folder, but the only hangup I'm having is
naming all of the buttons after the filenames of the MP3s - the .MP3 at the end.
I have already finished on making all the MP3s export to a folder, and a button is made for every single mp3 in the folder, but the only hangup I'm having is
naming all of the buttons after the filenames of the MP3s - the .MP3 at the end.
C#:
public int ButtonAmount = 5; public int x = 20;
public int y = 20;
public int files = 0;
private void Form1_Load(object sender, EventArgs e)
{
int fCount = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\MusicP", "*.mp3", SearchOption.TopDirectoryOnly).Length;
label1.Text = Convert.ToString(fCount);
Point[] p = new Point[fCount];
Button[] btn = new Button[fCount];
int buttoncount = 0;
string log = "";
DirectoryInfo d = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\MusicP");
FileInfo[] Files = d.GetFiles("*.mp3");
string str = "";
int stroong = 0;
foreach (FileInfo file in Files)
{
}
for (int i = 0; i < btn.GetLength(0); i++)
{
x = x + 0;
y = y + 40;
btn[i] = new Button();
btn[i].Height = 33;
btn[i].Width = 145;
btn[i].Location = new Point(x, y);
log += p.ToString() + "\n";
btn[i].PointToClient(p[i]);
btn[i].Show();
btn[i].Text = "MEMES";
btn[i].ForeColor = Color.FromArgb(255, 255, 255);
btn[i].Click += new EventHandler(Music_Click);
Controls.Add(btn[i]);
}
foreach (Control control in this.Controls)
{
if (control.GetType() == typeof(Button))
{
buttoncount = buttoncount + 1;
label2.Text = Convert.ToString(buttoncount);
}
}
}
private void Music_Click(object sender, EventArgs e)
{
MessageBox.Show("Button Clicks");
}
}