.net

COM/Interop - Supporting Multiple Versions

I've written a .NET console app that wraps CuteFTP's Transfer Engine - a COM object (ftpte). The version I wrapped is CuteFTP 7.0. I'd like to also support the 8.0 version, as some of the clients I integrate with have that version. I have a reference in my Visual Studio project to the CuteFTP COM object... how can I reference the vers...

.NET cryptography for licence keys?

Hi, I want to create a license key, which cryptography algorithm would you recommend? Basically the inputs would be: company name major version number date created expirey date has feature1: has feature2: has feature3: e.g. Acme Inc 5.0 20081102 20081102 0 1 0 DUPLICATE http://stackoverflow.com/questions/258721/which-built-in-net-c...

Phone number normalization: Any pre-existing libraries?

I have a system which is using phone numbers as unique identifiers. For this reason, I want to format all phone numbers as they come in using a normalized format. Because I have no control over my source data, I need to parse out these numbers myself and format them before adding them to my DB. I'm about to write a parser that can read ...

C# NullReference Exception and ReSharper suggestion

This is what I have written: if ((lstProperty[i].PropertyIdentifier as string).CompareTo("Name") == 0) Resharper put me an error (I am new with ReSharper... I am trying it) and it suggests me : if (((string) lstProperty[i].PropertyIdentifier).CompareTo("Name") == 0) Why is the second is NullException safe? For me both will crash ...

Getting .Net Font information?

Is there a wrapper around the Win32 API for getting font information without actually instantiating an instance of the .NET Font class? For example, some fonts do not have a regular style so I need to determine what styles are valid for a font without actually creating an instance of it. ...

How do I safely populate with data and Refresh() a DataGridView in a multi-threaded application?

My app has a DataGridView object and a List of type MousePos. MousePos is a custom class that holds mouse X,Y coordinates (of type "Point") and a running count of this position. I have a thread (System.Timers.Timer) that raises an event once every second, checks the mouse position, adds and/or updates the count of the mouse position on t...

How do I copy a file or folder that is locked under windows programmatically?

What are the API calls to copy a file that is currently locked. I'm hoping to be able to use .Net, but Win32 calls would be fine as well. Please feel free to chime in about the same functionality on Unix, or any other OS. ...

Scaling strategies for Service Tiers on .NET

I'm working on a web product that is composed of many modular web applications. To the end user, it appears to be one single application, though various components are broken out into their own apps. Part of the reasoning for this is so that it can be easily scaled horizontally across multiple application servers. To facilitate easier ...

WCF Lifecycle Events

Is there an event that fires when a WCF service gets started or shut down? Hopefully, independent of whether it is self hosted or hosted in IIS? ...

How to avoid duplicating logic on two similar WinForms?

I have two forms, form A and form B. These forms must differ in appearance, but they share a lot of logic. The problem is that this logic is tied to the appearance (validation on button click, events being fired, etc.). For example, I have a name field, and when the save button is pressed, I need to fire an event which causes the pare...

IDataReader empties when viewing for a second time

Hi, I'm getting something pretty strange going on when trying to read some data using the MySql .net connector. Here's the code: IDataReader reader = null; using (MySqlConnection connection = new MySqlConnection(this.ConnectionString)) { String getSearch = "select * from organization"; MySqlCommand cmd = new MySqlCommand(getSe...

C# version of __FUNCTION__ macro

Does anyone has a good solution for a C# version of the C++ __FUNCTION__ macro? The compiler does not seem to like it. ...

<base target="FrameName"> doesn't work on IE7

It seems that the following piece of HTML is ignored in IE7 but works ok in IE6/FF. It supposes to override all the html links to be opened in the desired frame <HEAD> <title>LeftPane</title> <base target="rightFrame"> </HEAD> The above code is the header of a left frame that holds an Infragistics UltraWebTree (tree menu) wh...

.NET text editor that accepts HTML and input/output with spellchecking

I have been searching for something that does this for a while now, but with no luck yet... We have an internal application that stores/uses text in HTML format. Now I am looking for a new control for editing it. I do not need a full-featured HTML editor, just something that can deal with simple formatting. It also needs spell check...

How big are various CLR runtimes?

I'm considering migrating a project to managed code, but I've heard that the .NET runtime is huge--several times larger than my executable binary, in fact. That just seems like the tail wagging the dog to me. But I've also been told that some CLR implementations, such as Mono, are modular, and you can create a custom distribution for t...

How do I share DAL and BLL across multiple .NET applications?

I need to create several applications that all share a Microsoft SQL Server database. These include ASP.NET web applications, WPF desktop applications, and probably the odd console app every now and then. I'd like to use the ADO.NET Entity Framework for data access, extend its objects for my business logic, and bind those objects to co...

Is there a built in .NET exception that indicates an illegal object state?

What exception should I throw if I encounter an illegal state - for instance, an initialization method that should only be called once being called a second time? I don't really see any built-in exception that makes sense. This seems like something that should be in the framework - am I not poking in the right spot? ...

strip out tag occurrences from XML

I'd like to strip out occurrences of a specific tag, leaving the inner XML intact. I'd like to do this with one pass (rather than searching, replacing, and starting from scratch again). For instance, from the source: <element> <RemovalTarget Attribute="Something"> Content Here </RemovalTarget> </element> <element> More...

.NET bug when converting float to integer?

Check it out: this little .NET Console Program yields interesting results...notice how I'm converting a float to an integer in two different ways: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CastVsConvert { class Program { static void Main(string[] args) { ...

n-tier object mapping help

Hi all. Wondering if my approach is ok or could be improved: Public Class Company private _id as Integer private _name as String private _location as String Public Function LoadMultipleByLocation(Byval searchStr as String) as List(Of Company) 'sql etc here to build the list End Function End Classs Thoughts on having...