我尝试使用 c# 制作媒体播放器,但当我想播放下一首歌曲时出现问题
“指数数组的边界之外。”
private void button2_Click(object sender, EventArgs e)
{
if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
files = openFileDialog.SafeFileNames;
path = openFileDialog.FileNames;
for (int i = 0; i < files.Length; i++)
{
listBox1.Items.Add(files[i]);
}
}
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
wmp.URL = path[listBox1.SelectedIndex];
}
"Index was outside the bounds of the array."
发生错误
wmp.URL = path[listBox1.SelectedIndex];