.net

Using Word COM objects in .NET, InlineShapes not copied from template to document

Using .NET and the Word Interop I am programmatically creating a new Word doc from a template (.dot) file. There are a few ways to do this but I've chosen to use the AttachedTemplate property, as such: Dim oWord As New Word.Application() oWord.Visible = False Dim oDocuments As Word.Documents = oWord.Documents Dim oDo...

Getting a set of elements using linq

I have the following piece of XML: <xml> <ObsCont xCampo="field1"> <xTexto>example1</xTexto> </ObsCont> <ObsCont xCampo="field2"> <xTexto>example2</xTexto> </ObsCont> <ObsCont xCampo="field3"> <xTexto>example3</xTexto> </ObsCont> </xml> How do I (using linq) get for example what is inside the xTexto...

WinForms - How do I access/call methods in UI thread from a separate thread without passing a delegate?

Hi, QUESTION: In .NET 3.5 WinForms apps, how do I access/call methods in UI thread from a separate thread, without passing a delegate? EXAMPLE: Say I have some code I want to run both (a) manually when the user clicks a button, and (b) periodically called by a process which is running in a separate non-mainUI thread but without passing...

Create/Send a SOAP HEADER to a Java Web Service in C#

I created the proxy class with wsdl.exe, but the method of service that I am communicating required to send you a user name and password for a SOAP HEADER. I do not know how to create the SOAP HEADER in C # and send it to the method of service. ...

How to call Lua functions from .NET

I use the LuaInterface library to run the lua in .net and it works fine. I could access the CLR via lua. But how to call Lua function from C#? ...

Build MSI to install DLL and make it accessible from "Add References" in VS

I'd like to build an MSI installer that installs a managed DLL and makes it accessible to users from Visual Studio's "Add References" menu in Solution Explorer. I believe I am supposed to add a key into the Windows registry but I cannot see how to tell the VS project for the MSI to do this at install. How is this done and where should I...

Best approach to managing software versions via code branches?

I would like to customize an off-the-shelf software that has a Lite Edition and an Enterprise Edition. The features are almost the same so that my extended customizations can work for both, but I have to recompile for each version because they have different version assemblies. Can someone help advise me on how maintain this? I am usin...

Throwing exception vs checking null, for a null argument

What factors dictate throwing an exception if argument is null (eg if (a is null) throw new ArgumentNullException() ), as opposed to checking the argument if it is null beforehand. I don't see why the exception should be thrown rather than checking for null in the first place? What benefit is there in the throw exception approach? This...

How do I marshal a pointer to an array of pointers to structures?

I have a C function with the following signature: int my_function(int n, struct player **players) players is a pointer to an array of pointers to struct player objects. n is the number of pointers in the array. The function does not modify the array nor the contents of the structures, and it does not retain any pointers after return...

Limit Access Using WCF Data Services

I've been checking out WCF Data Services today and it looks great - but so far I haven't been able to find much about security -- specifically, limiting access to the services based on the connecting account. In SQL you have some accounts that have read only access (and those are sometimes limited to a few tables) but so far in WCF Data...

Hashing the state of a complex object in .NET

Some background information: I am working on a C#/WPF application, which basically is about creating, editing, saving and loading some data model. The data model contains of a hierarchy of various objects. There is a "root" object of class A, which has a list of objects of class B, which each has a list of objects of class C, etc. Ar...

How to refresh to entire device's screen (Windows Mobile)?

Hi everybody, I'm working on a simple application that draws an alpha-blended picture on the screen's Device Context every 2 secs, I want to refresh the screen contents before the drawing operation (To erase the drawn pic), I have used many many trick but unfortunately, the screen won't refresh correctly, some regions still keep portio...

Make program make sure it has 3 instances of itself running at all times?

There's a .NET assembly and it needs to have 3 instances running at the same time all the time how can I monitor this. I am fairly positive it can be done by monitoring the system processes? ...

WPF -- How can I disable the default EditingCommands behavior on my custom richtextbox?

I want to disable the majority of the built-in functionality of the WPF Richtextbox that is found in "EditingCommands" How can I go about disabling them? ...

How to make a Generic Repository?

Hi I am wondering if anyone has any good tutorials(or maybe even a library that is already made and well documented) on making a generic repository. I am using currently linq to sql but it might change so I don't know if you can make a generic repository that would take little to no changes if I would say switch to entity framework. T...

How to clean up after myself when drawing directly to the screen

I'm drawing directly to the screen using BitBlt and GetDC(IntPtr.Zero). Is there some way to call Refresh or Invalidate on the whole screen when I'm done, so that I don't leave big chunks of paint everywhere (digitally speaking)? Update: when you draw directly to the screen like I'm doing, whatever you draw remains there until the win...

Digital Signature Device Recommendations (Mini Tablet)

I'd like to capture signatures of application users with a mini-tablet/little pos signature device. I welcome any first hand experiences of which ones were good and which ones to stay away from. Off the top of my head I can think of a few features I'd like to see: USB interface Not too expensive (I don't know 100-200 dollars?) Be eas...

.Net Remoting: Serialize Object and implementation

Hi, In my scenario there is a client-side assembly that contains a class (Task). This class implements an interface (ITask) that is known on the server. I'm trying to send a Task object from client to server without copying the assembly of the client manually to the server. If I just serialize the task object, the server obviously comp...

Automatic e-mail processing

I'd like to write a .NET application in F# to automate some of the processing of my e-mails. For example, when an order comes in my program might compute a new htpasswd from the e-mail's contents, upload it to our web server and reply to the customer with login details. How do people do this? I've tried Outlook 2007 automation but it ju...

How to check if MemoryStream can convert to Bitmap in .NET ?

As the question mentioned, I have a memorystream from a Byte[] ByteArr. How can I check if it can convert to a bitmap before using it with Bitmap myImg = new Bitmap(memorystream). Update Problem: In my situation, I load an Image from Internet through a URL, then if the Img downloaded already I change bitmap to base64string, if not downl...