Reputation: 47
I'm trying to make VB.Net open a video file when i type in the name for the film. This is what i have come up with so far:
Console.WriteLine("What film would you like to watch? ")
filmtv = Console.ReadLine()
Process.Start("G:\", filmtv)
This opens up the folder but doesn't open the file and begin playing. I'm still kind of a newbie so sorry if its a easy fix.
Upvotes: 0
Views: 823
Reputation: 237
Your nearly there, Ola's answer will work fine for Windows Media Player. If you want to open the file with the default program you have set to open video files rather than Windows Media Player try this:
Console.WriteLine("What film would you like to watch? ")
filmtv = Console.ReadLine()
Process.Start("G:\" & filmtv)
In VB.NET & and + are used to join strings together.
Upvotes: 1
Reputation: 1514
Try passing in two arguments to the Start method, player exe and file name. Ex,
Process.Start("%ProgramFiles(x86)%\Windows Media Player\wmplayer.exe", "name of file to play")
Source: https://msdn.microsoft.com/en-us/library/h6ak8zt5(v=vs.110).aspx
Upvotes: 0