.net

UnauthorizedAccessException vs SecurityException

The MSDN constructor for a FileStream says that it may throw either an UnauthorizedAccessException or a SecurityException. Here's what MSDN says about these exceptions. UnauthorizedAccessException: The exception that is thrown when the operating system denies access because of an I/O error or a specific type of security error. Security...

Is there a framework that works the way like updating a virus definition database?

my distributed program need update couple of files, i would like it to work the way like those anti virus software updating there virus definition database, is there such framework? Edit: I am not updating the application itself. when the update is done, the application may need reboot. A server will be open for update query and downl...

Is there any reason a .Net windows programmer needs to learn C or C++ anymore?

Can someone describe what advantages a C or C++ programmer would have over a .Net programming when developing for Windows? ...

Image capture of Windows mobile 5.0 camera using C# winform

I am trying to build an application to capture image from Windows mobile 5.0. With Capture button, Zoom button and save button. Please let me know if there is any reference Thanks in advance. ...

Image.FromStream does not hold a ref to the underlying stream

I have some code that does MemoryStream ms = new MemoryStream(); ... return Image.FromStream(ms); It fails in very eclectic ways since the Image object does not hold a ref to the stream, so it can get disposed if the GC kicks in which results in GDI+ errors. How do I work around this (without saving the stream to disk, or altering ...

how to change the date format from mm/dd/yyyy to dd-mm-yyyy in combobox?

i have a combobox which is displaying date from database...in my database the date enteries are in the format of mm/dd/yyyy but i want to display them in the format of dd-mm-yyyy...in that combobox..when the application run. ...

NHibernate - When FlushMode is given as Never and if I close the session by session.Close(), will the changes be sent to server?

If I have the FlushMode as Never and if I do a session.Close() will the changes be persisted to the database? Or do we have to explicitly say session.Flush() before session.Close()? Thanks ...

How to force an Exception if a Developer uses a property Incorrectly

I am trying to setup a few fixes in some code that have caught me out, and am trying to get some exceptions to spit out if the developer trys to access a property where rules haven't been met. nb. Lots of this class has been omitted for Clarity. myobject = new POSTerminalList(mCommonManagers) ' This should throw an error which it doe...

How to do dynamic downcasting in vb.net?

I have several classes, that all derives from SuperClass. When the classes are created, they all are put into a List(Of SuperClass). When I go through the list, i would like to downcast the SuperClass object to its baseObject, and put it into the correct list. (I have one list created for each of the sub types of SuperClass). It is p...

Notify when user clicks the camera button on Windows Mobile

I am a newbie to Windows mobile programming using .net CF. I am writing an application in C# in which I have to save the new image file created to a different folder when the user clicks the camera on the windows mobile phone. I have googled a lot on this, but have not found any solution. Using CameraCaptureDialog class enables/opens the...

Parse .msg file using C#

i need to parse .msg files of outlook. how to do it? is there any classes ? i fouund http://www.aspose.com/purchase/pricing-info-step-1-of-3.aspx Aspose it is a third party tool , which need a purchase . is there any other way without purchasing ??? ...

How to keep XmlSerializer from killing NewLines in Strings?

Suppose I have a simple Class with just one Member a String. public class Abc { private String text; public String Text { get { return this.text; } set { this.text = value; } } } Now when I serialize and then deserialize it with the questionable XmlSerializer any text containing newlines ('\r\n' or En...

Mark a record as 'in use' to support multithreading

My (simplified) table consist of an Id int identity(1,1), File varchar(20), FileProcessed bit The logic is this: my application takes first (the order isn't important) record, which has FileProcessed bit set to false. Then it processes the file and sets the FileProcessed bit to true. Now, it can happen, that the first thread takes a ...

How to save class object to file and then encrypt it with open and closed key

How to save class object to file and then encrypt it with open and closed key. closed key must be one for all (just for safe) and open key must be different for each file. I want use this code ... Looking like it is what I want but I still need Encryption. public ObjectToFile(_Object : object, _FileName : string) : bool { try...

How can I get .Net to save this image?

I have this jpeg, that opens fine in picasa, photoshop, web browser etc. but in .Net it just refuses to work. Image image = Image.FromFile(@"myimage.jpg"); image.Save(@"myimage2.jpg"); // ExternalException - A generic error occurred in GDI+. Is there any way to recover it in .Net so I can work with it (I need to resize it), witho...

Controls.Add(interface)

I have an interface that is implemented in a customcontrol: public interface IArrow{...} pulblic class Arrow1:UserControl, IArrow{....} pulblic class Arrow2:UserControl, IArrow{....} Then i have my form that shows the arrows doing: Arrow1 arr1=new Arrow1(); Arrow2 arr2=new Arrow1(); this.Controls.Add(arr1); this.Controls.Add(arr2); ...

how to copy the selected items from one listview to another on button click in c#net?

how can i copy selected items from one listview to another on button click..?? without any redundancy also can i give the option for multiple selection of items and adding them in a bulk without using the ctrl from keyboard?? making it user friendly can we use checkboxes and how will they work?? the code below is used to copy the enter...

How to Execute complex batch command on the fly

I looking the way to run DOS/windows batch directly from C# code without saving it as .BAT file before. I'm mainly interested to run DOS command with combination of stdin stream. Let's say I need execute something like that: echo 'abcd' | programXXX.exe -arg1 --getArgsFromStdIn After that programXXX.exe will take 'abcd' string as -ar...

is it possible to create a multilanguage installer using WIX ?

is it possible to create a multilanguage installer using WIX ? ...

How to stop an Excel process that I started from a C# .Net application?

I'm running Excel from a C# .Net application and having trouble getting the process to shut down. How can I get the Excel process to shut down correctly from my C# program? ...