.net

Saving Word 2007 Document Properties in C# 2.0

Hi all, I'm trying to modify some CustomDocumentProperties for a .docx document. So far I've been able to read the current value and modify it, but, for whatever reason, whenever I save the document the changes to the custom fields are lost. I have the following method within a DocAccessor class (which serves as an interface for my doc...

Exception while registering well know client type

Hi, I am using .NET remoting to communicate between the client and server. I implemented the client application and encountered an exception while registering an object on the client using "RegisterWellKnownClientType". The exception is "attempt to redirect activation of type which is already redirected". I get this exception only when ...

Load a DataGridView using Linq to SQL

How can I use Linq-To-SQL to load a DataGridView? Would the following work? DCDataContext db = new DCDataContext(); dataGridViewJobs.DataSource = db.jobs.Select(p => p.closeDate <= DateTime.Now); ...

How do I prevent my .NET SOAP client from including "Connection: KeepAlive" in the HTTP headers. (using WSE3.0)

In the HTTP Connection header, my web service client is including: Connection: Keep-Alive I want to disable this. After doing some research, it appears the way to do this is to set the KeepAlive member of the SoapHttpChannelOptions class to false. But, I do not see a way to access/modify SoapHttpChannelOptions in the webservice clien...

Serving VisualSVN

I am having hard time connecting to my visualsvn repository from computers outside of my home network So far I only tried replacing my computer name with my computer ip in the repository url but this does not work; https://MY-PC/svn/ProjectTrunk Can you point me the steps I need to ensure I can serve the repository to outside computer...

How do I format DateTime or TimeZone/TimeZoneInfo to display Three letters?

I'm working with a spec that calls for a peculiar Datetime format that I haven't necessarily had to work with yet. At Process time, an OFX (1 not 2) datetime must be stamped (either DTCLIENT or DTSERVER) in a format like this: 20071015021529.000 however, in the examples it is shown: 20071015021529.000[-8:PST] I don't have a prob...

Private assemblies under sub-folder cannot load dependencies

Our application dynamically loads a set of private assemblies that each reside under their own sub-directory. They each have their own dependencies which are also in that same sub-directory. Each assembly is strongly named and the dependencies are the same library, but different versions. MyApp |-> Folder1\ | |->PrivateAssembly...

ORMs that work with complex .Net generic objects (e.g. nested List<...>, etc)?

I am just starting to model the data for a new project, which must be persistable. Looks like the most natural OO model will have lots of nested .Net generics. Lists of objects, and these objects will also contain Lists of other generic types, and so on, nested at least three levels deep. Ideally, I'd like to just design the data mo...

Tutorials on how to create composite controls in Windows Forms?

Anyone knows any tutorials with this topic? I searched the net but I see mostly asp.net controls, not winforms. ...

Why Path.Combine doesn't add the Path.DirectorySeparatorChar after the drive designator?

var actual = Path.Combine("c:", "filename"); var expected = @"c:\filename"; Assert.AreEqual(expected, actual); Result {Assert.AreEqual failed. Expected:<c:\filename>. Actual:<c:filename>. Why? ...

Automating PGP decryption

We would like to automate the decryption of PGP files to our site so they my be processed. Our clients send PGP encrypted files to us via FTP. We have written a service which consumes these files and does stuff with the data. The problem we are having is determining a good (perhaps easy) way to decrypt the files from the service or ...

LINQ sorting special characters first?

It looks like special characters are not being regarded when sorting with LINQ and I didn't expect it to. Anyway, I need to sort special characters so they appear first in a list. Any ideas? I know I can do something like: http://stackoverflow.com/questions/921107/use-linq-for-arbitrary-sorting, but how do I allow the sort to extend pass...

Are There Reasons To Not Use CustomAttributes?

This is mostly a request for comments if there is a reason I should not go down this road. I have a multi-tierd, CodeSmith generated application. At the UI level there need to be some fields that are required, and the required fields will vary depending on field values in the bound entity. What I am thinking of doing is adding a "Proper...

Is it possible to build a Console app that does not display a console Window when double-clicked?

Related: Should I include a command line mode in my applications? How to grab parent process standard output? Can a console application detect if it has been run from Explorer? I want to build a console app, that is normally run from the command line. But, when it is double clicked from within Explorer (as opposed to being r...

Share dll data among different processes.

I have to implement a dll in C# which contains a list of tasks. The responsibility of this dll is to manage these tasks. Different processes will interact with this dll, each for its own task, identified by the task ID. But since each process will have its own copy of the dll data, the challange is how to manage this list. This list has...

How to properly stop a multi-threaded .NET windows service?

I have a windows service written in C# that creates a truck load of threads and makes many network connections (WMI, SNMP, simple TCP, http). When attempting to stop the windows service using the Services MSC snap-in, the call to stop the service returns relatively quickly but the process continues to run for about 30 seconds or so. The...

What is the most readable use of String.Format for long strings with many parameters?

For instance: String login = String.Format("computer={0}&ver={1}.{2}.{3}&from={4}&realcomputername={5}&type={6}&Channels={7}&Hotkeys={8}&ID={9}\r\n", serviceConfig.Computer, serviceConfig.Version.Major, serviceConfig.Version.Minor, serviceConfig.Version.Build, userName, ...

Raw HTML - how to measure width/height on the server?

I have a web application that lets users upload entire .html files to my server. I wish to 'detect' the width/height of the uploaded html and store it in my DB. So far, I have unsuccessfully tried using the System.Windows.Forms.WebBrowser control - by reading the file into a string, loading it into the browser.document: _browser = ne...

Hiding unwanted properties in custom controls

Is this the way to hide properties in derived controls? public class NewButton : Button ... [Browsable ( false )] public new ContentAlignment TextAlign { get; set; } Also this hides the property in the Properties window in the designer but how can I also hide the property in code? ...

Excel Interop: Application and ApplicationClass differences

I'm running into a problem with excel interop. Basically, what I'm trying to do is call a macro in an excel workbook from .NET with a complex argument type. However, in doing so I'm running into some differences between Application and ApplicationClass that are giving me some headaches. Here is some code: Dim complexType As New BigBa...