TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rizwan Saleem
NA
1
2.1k
i want to play a video file from list box in media player.
Jun 16 2016 4:58 AM
i am working on windows form application and i want to play a video file in media player from list box.i get those video files from my project directory and kept in list box.the source code shows an error when i pass the URL to ax-media player that is "can not implicitly convert type object to string".how can i fix this or is there any other way to play that video.
here is the code
private void button1_Click(object sender, EventArgs e)
{
string path = @"abc";
foreach (string s in Directory.GetFiles(path, "*.mpeg4").Select(Path.GetFileName))
listBox1.Items.Add(s);
}
private void button2_Click(object sender, EventArgs e)
{
listBox1.SelectedItems.Clear();
for (int i = 0; i < listBox1.Items.Count; i++)
{
if (listBox1.Items[i].ToString().Contains(cmbox_tchr.SelectedItem.ToString()))
{
listBox1.SetSelected(i, true);
}
}
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
axWindowsMediaPlayer1.URL = listBox1.SelectedItem;
axWindowsMediaPlayer1.Ctlcontrols.play();
}
}
}
Reply
Answers (
1
)
c# keyboardhook convert
How to download a complete web page source code