.net

Free Windows Forms Components Similar to jQuery UI Draggables

EDIT: So, I ended up making my own basic solution to this problem, and it can be found in my own answer to the question below. Or, here's a link. Original Post I'm doing some UI programming for a small .NET application. The application has some collections of items that need to be displayed in a grid sort of format (X columns by Y row...

Possible to have strings for enums?

I want to have an enum as in: enum FilterType { Rigid = "Rigid", SoftGlow = "Soft / Glow", Ghost = "Ghost", } How to achieve this? Is there a better way to do this? It's gonna be used for an instance of an object where it's gonna be serialized/deserialized. It's also gonna populate a dropdownlist. ...

ScriptManager adding script multiple times to page

So I've got a script that I'd like to add to a page using a ScriptManager, but the script gets added multiple times. The script I'm trying to add plus the call to register it (in the C# code behind) are as follows: string buttons = @"var overflowEls = getElementsByClass(""descriptionBox""); for (var i = 0; i < overflowEls.leng...

Marshalling .NET generic types

Here is a C# program that tries Marshal.SizeOf on a few different types: using System; using System.Runtime.InteropServices; [StructLayout(LayoutKind.Sequential)] class AClass { } [StructLayout(LayoutKind.Sequential)] struct AStruct { } [StructLayout(LayoutKind.Sequential)] class B { AClass value; } [StructLayout(LayoutKind.Sequent...

Compiler options for C# project

Where I can change compiler options for C# project in VisualStudio 2008 (without command prompt). I need it to turn off optimization to compare optimized IL-code and unoptimized IL-code. ...

Convert TrueType Font (or JPG image) to PNG image with Alpha Transparency in .NET?

Anyone know how to convert either a TrueType Font or JPG image into a PNG image with Alpha Transparency in .NET? I basically want to create a script-looking signature image that has a transparent background so that I can programmatically add that png signature into PDF documents after they've been created. I can do this with a normal J...

Convert.ToDateTime causes FormatException on afternoon date/time values

We have an application parsing date/time values in the following format: 2009-10-10 09:19:12.124 2009-10-10 12:13:14.852 2009-10-10 13:00:00 2009-10-10 15:23:32.022 One particular server all of the sudden (today) started failing to parse any times 13:00:00 or later. This particular client has five servers and only one has the problem...

Multiple Left Outer Joins in LinqToSql?

Is it possible to accomplish something like this using linqtosql? select * from table t1 left outer join table2 t2 on t2.foreignKeyID=t1.id left outer join table3 t3 on t3.foreignKeyID=t1.id I can make it work using both DataLoad options or join syntax. But the problem is whenever I add a second left join, linqtosql queries with MULT...

Regex: Insert a value in a capture group based on a conditional match?

First, this topic is a general regex question, but applies to a specific product - VirtualURL.NET (.NET HttpModule). I am using this product to do regex URL rewriting. I have a situation which I am attempting to accomplish in a single regex rule. I am matching against the following URLs: ~/directory/page.aspx?id=idval ~/directory/pag...

App.config namespace issue

I'm working with an interface generated by from a wsdl, and I'm running into an issue when trying to host my service as a Windows Service. The following line appears above the interface. Unless I change it from [System.ServiceModel.ServiceContractAttribute(Namespace="http://xxxxxx.com/", ConfigurationName="IService")] to [S...

How can I find out if there are windows above a control?

If I have a Winforms control, is it possible to tell if there are windows (from any application) above it? Basically, I need to know what parts of my control are actually visible on screen. ...

XmlTypeAttribute does not change name of type

I'm working on a project that calls a web service using WSE3. The types originally generated using VS2005 have been modified over time. Now, I need to change the name of the type in the SOAP message. I gather that should be done using XmlTypeAttribute, but that does not affect the type name. As an experiment, I used XmlElementAttribu...

Property vs Function (specifically .NET)

I've read some discussions about this subject, and there's something I just don't understand. The most common answer seems to be this: use a ReadOnly Property to return cached data, use a Function to return non-cached data. Don't use a WriteOnly Property at all, cause "it doesn't make sense". There is no performance reason for this. In...

VS 2008: Project Dependencies and Build Order all out sync, plugin available?

Hi there, I have quite a large project, actually 2 but they share a lot of projects between each other. The problem being when i compile from NOTHING i.e. no dll's in my common bin dir it fails.. This is due to the fact that some projects are not compiling before others that are dependent on them. I have fixed it manually going throug...

Selecting combination using linq

This is also one of the interview question i have faced recently. Description : The task is $ 100(Please consider some currency) will be given to me.I need to purchase three items itemA,itemB,itemC.The cost of (I am not sure 0.25$ or 0.75 $ are meaningful,so think it as other currency) itemA=0.25$,itemB=0.75$ and itemC=20$. I need to p...

C# - Windows Service installer fails in custom action

We install a windows service from a custom action as described here: CodeProject Every so often, when uninstalling our application, it does not properly uninstall the service. Instead it "marks the service for deletion". You can see this message by running installutil.exe /u on our executable, when it is supposedly uninstalled. Has a...

High-speed performance of image filtering in C#

I have Bitmap. I want to apply median filter to my bitmap. But I can’t use GetPixel() and SetPixel() because speed is very important factor for me. I need very fast way to do it. May be it can be done with a Graphics.DrawImage(Image, Point[], Rectangle, GraphicsUnit, ImageAttributes). After median filter I want to apply binaryzation fil...

Binding a POCO to an html document and generating the result to a string

I am trying to return an html string from a method in a class library (don't ask why). What i would like to do within the method is get an instance of a POCO from my domain, then open an html document (maybe from a file or maybe it is a string from somewhere else), then pass the POCO to the document (which has bindings to the POCOs prop...

Linq to Sql - Populate JOIN result into a List

I am not sure if this can be done, but here's the scenario. I want to turn this sql into linq: SELECT * FROM Department d INNER JOIN Employee e ON e.DepartmentID = d.DepartmentID Department - Employee is 1 to many relationship. I have created a custom object that I would like to populate the result into. public class DepartmentSum...

Data gathering - web service or hosted web application?

I need to gather information from a number of web sites on a regular basis throughout the day and present that information to a number of client applications via a web service interface. Is it possible to do this and deploy the resulting "application" via a commercial hosting package or do I need to go to a dedicated server in order to ...