.net

.NET - Converting Color Name Strings into System.Drawing.Color

What is the best way to turn strings like "red", "green", "yellow", "aliceblue", etc... into the actual System.Drawing.Color value? I was looking at reflection and something about that didn't seem right. ...

Is it possible to determine in which language a .NET Assembly was written ex post facto?

This started as a way to find C++/CLI and Managed C++ assemblies so that all classes internal to them could be tested to ensure all inherited methods were being reimplemented. I would like to add this as a build process step to ensure that it never happens again. Thinking about this problem also made me a bit curious as it would be int...

Can I redirect events in .NET?

I've got a class which is catching the System.Diagnostics.DataReceivedEventArgs event. I want to make this event externally available. To accomplish that currently I'm catching this internally and raising another event, which seems like a bit duplication to me. What's the best way to this? Can I wire these events so I do not need to ...

run assoc command without launching cmd.exe

I am trying to find file associations before attempting to launch the file, the best way I could come up to find that association was using the assoc command, my question is can I run this command through some API way? Right now the application launches a cmd window to run the command and then parse the output. ...

ASP.NET ListView, custom DataSources, and editing items

The MSDN walkthroughs provide a number of examples where you can drag a DataSource from the toolbox, run through some simple configuration steps, then drag a ListView onto the screen, point it at the DataSource, and hey - you've got full table editing. Now I'm trying to write my own DataSource class (a class that implements System.Web....

Windows Forms listbox is overflowing when there are too many items to scroll.

Hi, I am building an indexer application based on a suffix tree, that enables me to index whole documents and search strings, substrings, etc, extremely fast. What I'm doing is entering a string in a textbox, pressing a button, and running a function that queries the suffixtree and adds the positions of all occurences of the string to a...

How do i get the the full name of the proxyed type for a nhibernate DynamicProxy?

I am using a netdatacontractserializer and a SerializationBinder to create my own runtime types for nhibernate proxies on the client side. This all works except I am forced to assume that there is only one type by each name in the domain model. i.e. i am forced to ignore the namespace. The reason is that SerializationBinder only gives m...

Can I get specific metadata from a Func<T, object>?

Consider the following code: string propertyName; var dateList = new List<DateTime>() { DateTime.Now }; propertyName = dateList.GetPropertyName(dateTimeObject => dateTimeObject.Hour); // I want the propertyName variable to now contain the string "Hour" Here is the extension method: public static string GetPropertyName<T>(this IList<...

"Good" Database Record Comparison tool?

I am a system administrator for a company that supports a CRM CMS (Salesforce). I don't like the built-in functionality so I generally manage data through CSV/XLS files for uploading and downloading, because I can write better queries and the like. One of my tasks is uploading Contacts and Accounts. Because of a lack of unique Identifie...

Set Value of a TextArea inside a WebBrowser Control (C# / .NET)

I'm looking to set the value of a TextArea using the .NET WebBrowser Control. I have been able to set the values of textboxes using the following code (replace "username" with the name of the texbox): webBrowser1.Document.All.GetElementsByName("username")[0].SetAttribute("Value", "SomeUser"); I tried using similar code on a TextArea ...

Point of Sale Machine Software Development

I want to create a Point of Sale (POS) machine and software for it. Are there any How-To guides for this? Hardware I know where to find the hardware, but I am just wondering if there are any hardware brands in particular that allow customization, such as using .NET's APIs for the machine (cash till, printer, etc). Software My que...

allocation: struct inherits from the class

If struct inherits from the class, in other words, value type inherits from a reference type, where is memory allocated: heap or stack? Thanks Edit#1 If there is no inheritance allowed, then why is the following legal: class Samplewhere T:class where U:struct, T In the case above, parameter U is value type, and it derives from T...

Patterns for implementing transactions outside of a database

I have to send an email, write to a file, and call a web service. To maintain consistency, all steps must happen. If any step throws an exception or errors out, all steps must be rolled back. Before I go rolling my own object ACID engine, are there any commonly accepted patterns for implementing ACID semantics at the object level? Bett...

What's the best way to develop a custom logon/authentication system in ASP.NET

The website I'm developing will allow users to login at 3 levels. Level 1 - Not logged in Level 2 - They register their email address and receive a confirmation email, and login that way. Level 2 - They login with a username/password, which is then sent to a web service. If the web service comes back with a "successful login" result, ...

.NET, Java to JavaScript compiler

I am interested to create a drag-and-drop layout designer using only JavaScript, HTML and CSS. The designer will allow the user to drag the page elements from one place to another (something like Blogger's layout designer) to create a site layout. But I don't want to hand code everything in JavaScript, I would prefer to write my applicat...

How do I make a namespace containing 'System' in .NET without it conflicting?

Sometimes I've made a namespace in C# (I don't know if the problem is the same in VB.NET) containing 'System' and when I include it from a different DLL it goes crazy and conflicts with everything containing 'System'. This leads to crazy errors such as the following : The type or namespace name 'ServiceModel' does not exist in the ...

Converting an object of the type Object to another type using a Type object

Having an object like this: object integerObject=1; And an object like this: Type integerType=typeof(Int32); How can be the integerType object used to cast the integerObject to the type of Int32 ...

What is a good Telnet client implementation C#?

What would be a good open source Telnet client implementation in C#, which can be used in close code (i.e., not under GPL)? Boaz ...

New to Unit Testing

I would like to know how to implement unit testing in an existing (quite large) application using visual studio 2008 (.net 2.0). I understand that developing unit tests for the existing/legacy code is not realistic but I would like to have tests for code moving forward. I have found plenty of examples on how to write tests for code but...

SharePoint development environment setup

Hi, i need to setup a development environment for writing Share Point Web Parts. What do I exactly need? My development machine is a Windows XP Prof. with Visual Studio 2008 Prof. If found Windows Share Point Services 3.0: Software Development Kit (SDK) and Windows Share Point Services 3.0: Tools Visual Studio 2008 Extensions, Versio...