|
Hello,
I am writing a simple C# program that will play an AVI file in a Form. I am able to currently do this by specifying the path for the file, and telling my program to open it from there. However, I would like to be able to somehow include this video as a part of the compiled .exe, so that, for example, I could play this video on another computer which doesn't have the video on its hard disk.
I have tried this by going to Properties, then "Add Existing File", and then browsing and finding my video file. This seemed to work fine, until I then tried to build the project, and I got the error:
The "GenerateResource" task failed unexpectedly.
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Resources.ResXFileRef.Converter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
at System.ComponentModel.TypeConverter.ConvertFrom(Object value)
at System.Resources.ResXDataNode.GetValue(ITypeResolutionService typeResolver)
at System.Resources.ResXResourceReader.ParseDataNode(XmlTextReader reader, Boolean isMetaData)
at System.Resources.ResXResourceReader.ParseXml(XmlTextReader reader)
at System.Resources.ResXResourceReader.EnsureResData()
at System.Resources.ResXResourceReader.GetEnumerator()
at Microsoft.Build.Tasks.ProcessResourceFiles.ReadResources(IResourceReader reader, String fileName)
at Microsoft.Build.Tasks.ProcessResourceFiles.ReadResources(String filename, Boolean shouldUseSourcePath)
at Microsoft.Build.Tasks.ProcessResourceFiles.ProcessFile(String inFile, String outFile)
at Microsoft.Build.Tasks.ProcessResourceFiles.Run(TaskLoggingHelper log, ITaskItem[] assemblyFilesList, ArrayList inputs, ArrayList outputs, Boolean sourcePath, String language, String namespacename, String resourcesNamespace, String filename, String classname, Boolean publicClass)
at Microsoft.Build.Tasks.GenerateResource.Execute()
at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult) WindowsFormsApplication3
I don't know what this means, but it seems to suggest my video file is too big to be a resource or something. The video file is an uncompressed AVI file, but it is only 250 MB, so surely this can be a part of the executable?
If not, then is there a way that I can keep the video file and the .exe file separate, but allow the .exe file to use the video file? (without specifying the path name.)
Another quick question - I have tried adding a bitmap as a resource, and this has worked fine, but how do I then use this file? For example, if I wanted to display this bitmap as the image in a picture box, how do I reference the bitmap in the resources?
Thank you for any help on this!!
Ed.
|
|
|
|
|
|
Thanks for your help Leppie.
I already added the file as an embedded resource, and it still gave me the error. I am using Windows XP, not Vista...
Is there anyway I can keep the .exe and .avi files separate in that case? But still allow the .exe to use the .avi without knowing the path name?
Thanks,
Ed.
|
|
|
|
|
ejohns85,
Just a thought, but you could include the avi in your deployment package (eg: installer)
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
I'm creating .NET 3.5 WinForms application.
I need to create textbox which remembers last 10 entries (stores in isolated storage) and
offers users to select them on entry just like IE auto-complete address bar.
I think I must use textBox custom AutoCompleteSource.
Any idea or sample how to implement this ?
Andrus
|
|
|
|
|
AndrusM wrote: Any idea or sample how to implement this ?
Search for the articles here on CodeProject, there should be many.
|
|
|
|
|
Thank you.
I made some search but havent found any.
Can you point me to some articles, please.
I need to run this under MONO also, so best is wihtout direct winapi calls.
Andrus
|
|
|
|
|
AndrusM wrote: I made some search but havent found any.
Try harder
|
|
|
|
|
Hi.
I am developing a pocket pc application using c# and VS 2008. I have a web service with some methods to make CRUD
operations and connect the pocket pc application to SQL Server 2005. So far so good.
I need to send the information to connect to the database server from the pocket pc to the web service, you know, the
server name, user id, password and database name. At this point i have a problem. I don't know how to pass that info
from PPC to the web service or i don't know what is the correct way to achieve this.
I have tried this:
public class MyService{
public MyService(string server, string uid, string pwd, string database){
}
}
I have added in the constructor method of the web service some parameters to send the connection information from the
pocket pc to the WS.
But the problem is that i can not send information via parameters to the constructor of the class or WS. I mean, i have this
code in my ppc app:
MyService ws = new MyService("server","sa","123","mydata");
This code does not work 'cause it seems that i can not send information, parameters to the constructor of the web service.
So i would like to know what is the correct way to connect an application to the database making use of web services, or
how to send connection information from any app to the web service to connect to sql server.
One way could be sending this info to any method i have in the web service, but i don't like this way, i think it's not
the right way.
Thanks for your time.
Bye...
Henry de Sousa
|
|
|
|
|
HenrydeSousa,
Use properties.
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
Hi.
Thanks for your answer.
This is what i'll do. I'll create four static properties in a class and store the server name, user id, password and database name
to the properties form the pocket pc app, then when i need to call a method of the web service to communicate with the database i'll
send these properties as parameters to the methods.
I guess this is what you meant, i tried to create a property in the web service and stablish the value to that property
from the pocket pc app but i can not access any property of the web service, if i am wrong please tell me.
Regards...
Henry de Sousa
|
|
|
|
|
Hi all,
I have an application developed with c#.net and it getting a error rarely, saying we are middle of something application needs to be closed. I have used tcp communication, streaming using grabber like that. Application is running nicely, but it is giving that error suddenly. I cant trace the error in my application handling exception. The things is I have also same error message from Internet Explorer even. I cant imaging how that error comes. If you guys know regarding that error please let me know and also can you tell me stop that error. I have attached the error messages.
Error Message :
“If you were in the middle of something, the information you were working on might be lost.”
|
|
|
|
|
Run the application in a debugger and find out why.
|
|
|
|
|
That's not even an error message. It doesn't say anything at all about what it might be that went wrong, or even that something definitely did... It only implies that something may have gone wrong, as there might be some consequences...
Check if you can get hold of a real error message, perhaps in the event log.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi Friends,
I dont know in which section should I post this question coz it related to both C# and ASP.NET.
I have very strange requirment.
I our project we developed our application in windows forms project. The project contains a bunch of class libraries and number of windows usercontrol libraries.
Now we are hosting those user controls to the web.
Everything is working fine till the control with FileOpenDialog in it comes in picture.
When that user control opens in web it throws the followin exception.
"Application attempted to perform an operation not allowed by the security policy. To grant this application the required permission contact your system administrator, or use the microsoft .net frameword configuration tool.
Request for permission type 'system.security.permissions.fileiopermission, mscorlib, version=2.0.0.0, Cultrue=neutral, pulickeytoken=xxxsdlff' failed."
I know the reason why this exception is coming.
what I want to know is , is there any work aroud of this problem except using asp.net "file" control?
Thank you all in advance.
Thanks and regards,
Chetan Ranpariya
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Is the web app running under full trust?
|
|
|
|
|
Do you mean that you're using Windows Forms controls in a webpage, where the control is downloaded to the browser?
Those controls run in a security sandbox, to prevent them from damaging the rest of the system (this is the same as Java applets). The CLR enforces this security sandbox by preventing code from being loaded that would violate the security policy.
One of the things that remote code is not allowed to do is open arbitrary files directly using the
FileStream class or its derivatives. You can generally, however, open files via an
OpenFileDialog , if you use the
OpenFile method of the dialog object. You cannot find out the filename using the
FileName property.
The .NET Framework security set is quite granular. The exact permissions to perform a task are generally listed at the bottom of the documentation. You can find the list of defaults at Default Security Policy[^]. Your code, if running in a web page, will come under the Local Intranet zone if on the local network (and, in IE 7.0, the computer is on an Active Directory domain) and under Internet if on a different network.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
Hi all,
I'm working on a university results project and i need to transfer data from an already existing Excel spreadsheet to my sql server database, so that i can readily perform queries on legacy data. I also intend to use the DAAB of the Microsoft Enterprise Library (January 2006)to implement it.
Can anyone help me on how to go about this?
Obinna from Nigeria.
//obinnaaj Eof
|
|
|
|
|
If you are trying to do this by C# code, then I suggest looking at the Microsoft.Office.Interop.Excel namespace
|
|
|
|
|
Hi all,
I am trying to write a function which converts plural words into singular words. Below is the function which i have created but it is not working properly for the words which ends with -se like lease, prise etc. Means when it comes to conver these words from plural to singular it is not giving proper output.It is converting "Leases" to "Leas" and "phrases" to "Phras".
Please help me as soon as possible!
private void _StripPlural(string strValue)
{
if (strValue.Length > 1) {
if (strValue.EndsWith("s")) {
strValue = strValue.Substring(0, strValue.Length - 1);
string strPluralRule="s,z,x,ch,sh,ss";
bool blnFlag = false;
char[] arrchDelimeter ={ ',' };
string[] arrstr = strPluralRule.Split(arrchDelimeter);
for (int i = 0; i < arrstr.Length; i++)
{
string strTest = arrstr[i] + "e";
if (strValue.EndsWith(strTest) && !strValue.EndsWith("sse"))
{
blnFlag=true;
return;
}
}
if (blnFlag == true)
{
strValue = strValue.Substring(0, strValue.Length - 1);
}
if (strValue.EndsWith("ie")) {
strValue = strValue.Substring(0, strValue.Length - 2) + "y";
}
if (strValue.EndsWith("sse")) {
strValue = strValue.Substring(0, strValue.Length - 1);
}
}
}
//return strValue;
}
Regards,
|
|
|
|
|
KBM73 wrote: string[] arrstr = strPluralRule.Split(arrchDelimeter);
That will eat your delimiters, how will you add it again? You will have to think of another way
|
|
|
|
|
leppie wrote: You will have to think
Doesn't the OP pretty much rule that out?
led mike
|
|
|
|
|
|
hey how to create dynamic gridview in default.aspx in page_load event
|
|
|
|
|
1. Add a placeholder on your ASP page (VERY IMPORTANT!).
2. Create a gridview from code, and add it to your placeholder's Control collection.
|
|
|
|
|