473,396 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How do I access a .avi stored as a resource?

110 100+
I'm trying to load a video file that I have added to my resources to play when a button is clicked. When the button is clicked the video should both load and play. Here is my code that fails:
Expand|Select|Wrap|Line Numbers
  1. video = new Video(properties.resources.koala_talk);
this does not work. It says Arguement1 can not be converted from "byte[]" to "string" However if I hard code the directory it works:
Expand|Select|Wrap|Line Numbers
  1. video = new Video(@"C:\assignment3\koala_talk.avi");
  2.  
How do I reference the .avi that is located in my references and not hard code to the one not in my resources?


Thanks for the help guys.
Sep 21 '10 #1
2 3806
You can add the file to the solution as an embedded resource. Add the avi to the soulution, right click on the file and select properties, in properties change the build action to embedded resource.

You can use the GetManifestResourceNames method to get the names of the embedded resources in a assembly.

string[] names = Assembly.GetExecutingAssembly().GetManifestResourc eNames();

Use the GetManifestResourceStream with the resource name to get a stream.

Assembly.GetExecutingAssembly().GetManifestResourc eStream("MyNameSpace.MyEmbeddedResource.avi");
Sep 22 '10 #2
try following code to extract resource form resource:

Expand|Select|Wrap|Line Numbers
  1. File.AppendAllText(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\abc.avi", Properties.Resources.abc);
  2.  
Sep 25 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: David | last post by:
Hi everyone. I have read every page that Google returns on this topic, but can't find anything that resolves my problem. Basically, I have an Access Database that does a number of different...
1
by: Jack | last post by:
Hi, I am working on a asp page where I am opening a recordset object using an Access stored query named "GMISExpenseCombo". I have to use this resultset with various fields in the page. Howeve,r...
2
by: Jeff Lowry | last post by:
I'm pasing a zip code as a prameter to an Access stored procedure. In Access the parameter is a text data type. It works for non-leading zero zip codes but, apparently access (or ASP) is...
1
by: Savas Ates | last post by:
my stored procedure in access XP (I create it Succesfully) It returns me all records.. For example in my db there are records with catid=1 but no record with id=2 I try my code both catid=1 and...
1
by: Dan Caron | last post by:
I have this stored procedure below that works great in SQL Server. The sql purges rows out of a table, leaving "x" # of rows in the table ("x" = s.RetainHistoryNum below). Now I need it to run in...
2
by: Marco Frontini | last post by:
I had a strange error in asp.net when try to execute a simple select statement like "Select * From ViewName" if the stored view contains a where clause. The connection is made to an Access...
2
by: Greg Schumacher | last post by:
Running PHP v5.0.4 (compiled by www.entropy.ch) and mysql 5.0.16 on Mac OS X 10.4.3. When I run the simple test script below the first query sent from PHP to MySQL is successful but the second is...
0
by: Miguel Dias Moura | last post by:
Hello, I have an Asp:Image in my page and I need to use an image which I added to my resources in my aspx.vb code. Something like: Sub MyImage() MyImage = MyImage in Resources file End Sub
1
by: Michael | last post by:
Hi. I am working with classic ASP. I'd like to transfer al my hard coded sql queries to access stored queries and use them with parameters. Actually, I did not find any strong information how to do...
5
by: =?Utf-8?B?U3RldmVU?= | last post by:
I am using in my code. I want to be able to reference a text string within my "Resource file" like this: . The issue is that Description requires a constant string. Is there anyway to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.