.net

Why won't .NET deserialize my primitive array from a web service?!

Help! I have an Axis web service that is being consumed by a C# application. Everything works great, except that arrays of long values always come across as [0,0,0,0] - the right length, but the values aren't deserialized. I have tried with other primitives (ints, doubles) and the same thing happens. What do I do? I don't want to ch...

Winforms - Click/drag anywhere in the form to move it as if clicked in the form caption

I am creating a small modal form that is used in Winforms application. It is basically a progress bar of sorts. But I would like the user to be able to click anywhere in the form and drag it to move it around on the desktop while it is still being displayed. How can I implement this behavior? ...

Moving from Visual Studio 2005 to 2008 and .NET 2.0

Hello, I'm currently using VS2005 Profesional and .NET 2.0, and since our project is rather large (25 projects in the solution), I'd like to try VS 2008, since its theoretically faster with larger projects. Before doing such thing, i'd like to know if what I've read is true: can I use VS2008 in ".net 2.0" mode? I don't want my custome...

Compare Version Identifiers

Here is my code, which takes two version identifiers in the form "1, 5, 0, 4" or "1.5.0.4" and determines which is the newer version. Suggestions or improvements, please! /// <summary> /// Compares two specified version strings and returns an integer that /// indicates their relationship to one another in the sort order. ...

Resize transparent images using C#

Does anyone have the secret formula to resizing transparent images (mainly GIFs) without ANY quality loss - what so ever? I've tried a bunch of stuff, the closest I get is not good enough. Take a look at my main image: http://www.thewallcompany.dk/test/main.gif And then the scaled image: http://www.thewallcompany.dk/test/ScaledImage...

Compile a referenced dll

Using VS2005 and vb.net ... I have a project that is an api for a datastore that I created. When compiled creates api.dll. I have a second project in the same solution that has a project reference to the api project which when compiled will create wrapper.dll. This is basically a wrapper for the api that is specific to an application. Wh...

Regex to validate URIs

How do you produce a regex that matches only valid URI. The description for URIs can be found here: http://en.wikipedia.org/wiki/URI_scheme. It doesn't need to extract any parts, just test if a URI is valid. (preferred format is .Net RegularExpression) (.Net Version 1.1) Doesn't neet to check for a known protocol, just a valid one. ...

Authenticating Domain Users with System.DirectoryServices

Given a username and a password for a domain user, what would be the best way to authenticate that user programatically? ...

Fastest way to calculate primes in C#?

I actually have an answer to my question but it is not parallelized so I am interested in ways to improve the algorithm. Anyway it might be useful as-is for some people. int Until = 20000000; BitArray PrimeBits = new BitArray(Until, true); /* * Sieve of Eratosthenes * PrimeBits is a simple BitArray where all bit is an integer * and ...

What is the best way to share MasterPages across projects

Suppose you have two seperate ASP.NET Web Application projects that both need to use a common MasterPage. What's the best way to share the MasterPage across projects without having to duplicate code? Preferably without having to resort to source control or file system hacks. ...

How do you configure an OpenFileDIalog to select folders?

In VS .NET, when you are selecting a folder for a project, a dialog that looks like an OpenFileDialog or SaveFileDialog is displayed, but is set up to accept only folders. Ever since I've seen this I've wanted to know how it's done. I am aware of the FolderBrowserDialog, but I've never really liked that dialog. It starts too small and...

What control is this? ("Open" Button with Drop Down)

The "Open" button on the open file dialog used in certain windows applications includes a dropdown arrow with a list of additional options -- namely "Open with..". I haven't seen this in every windows application, so you may have to try a few to get it, but SQL Server Management Studio and Visual Studio 2005 will both show the button ...

Process Memory Size - Different Counters

I'm trying to find out how much memory my own .Net server process is using (for monitoring and logging purposes). I'm using: Process.GetCurrentProcess().PrivateMemorySize64 However, the Process object has several different properties that let me read the memory space used: Paged, NonPaged, PagedSystem, NonPagedSystem, Private, Virtua...

Accessing a Component on an inherited form from the base form

A number of forms in my project inherit from a base form. It is easy to get at the Controls collection of the derived forms, but I have not found a simple way to access the Components collection, since VS marks this as private. I assume this could be done with reflection, but I'm not really sure how best to go about it, not having work...

Constructors with the same argument type

I have a Person object with two constructors - one takes an int (personId), the other a string (logonName). I would like another constructor that takes a string (badgeNumber). I know this can't be done, but seems it might be a common situation. Is there a graceful way of handling this? I suppose this would apply to any overloaded met...

.Net Compact Framework scrollbars - horizontal always show when vertical shows

I am new to the .Net Compact Framework and have been unable to find an answer via Google. Gasp! Yes, it's true, but that is part of why stackoverflow is here, right? I have a form that is longer than the screen, so a vertical scrollbar appears as expected. However, this appears to force a horizontal scrollbar to appear as well. (If I sc...

Do you need the .NET 1.0 framework to target the .NET 1.0 framework?

I have a bunch of .NET frameworks installed on my machine. I know that with the Java JDK, I can use the 6.0 version to target 5.0 and earlier. Can I do something similar with the .NET framework - target 1.0 and 2.0 with the 3.0 framework? ...

How stable is WPF?

How stable is WPF not in terms of stability of a WPF program, but in terms of the 'stability' of the API itself. Let me explain: Microsoft is notorious for changing its whole methodology around with new technology. Like with the move from silverlight 1 to silverlight 2. With WPF, I know that MS changed a bunch of stuff with the rel...

How to properly cast objects created through reflection

I'm trying to wrap my head around reflection, so I decided to add plugin capability to a program that I'm writing. The only way to understand a concept is to get your fingers dirty and write the code, so I went the route of creating a simple interface library consisting of the IPlugin and IHost interfaces, a plugin implementation library...

Broadcast like UDP with the reliability of TCP

I'm working on a .net solution that is run completely inside a single network. When users make a change to the system, I want to launch an announcement and have everyone else hear it and act accordingly. Is there a way that we can broadcast out messages like this (like UDP will let you do) while keeping guaranteed delivery (like TCP)? ...