.net

Create a MustOverride Property with Reflection?

Can anyone tell me how I would create a MustOverride property using Reflection? ...

when is it ok to use a structure rather than a class

In a recent project I was working I created a structure in my class to solve a problem I was having, as a colleague was looking over my shoulder he looked derisively at the structure and said "move it into a class". I didn't have any argument for not moving it into a class other than I only need it in this class but this kind of falls ...

Get ProgID from .NET Assembly

I want to write a program to find all the com visible .NET classes, and their ProgIDs from a .NET assembly. What's the best way to do this? ...

Can we implement Row Lost Focus event for GridView

I have a Hierarchical gridview and I need implement the following functionality in the child gridview: Show all the rows in editable mode (this can be done) Save all data of each row on it's lost focus We can capture the mouse events but how do we track the row lost focus triggered by the Keyboard. Ex: when a row is in focus, hitting...

How to handle starting/stopping API interface that may take a long time to start

I have an application that needs to work with a vendor-supplied API to do Screen Pops when a call is routed to the user's extension. Another developer worked on getting the API to work and delivered a prototype wrapper class that isn't quite right, and I'm trying to get it right. Because this API can block for several minutes before re...

Can't see Methods, etc. in Visual Studio 2008 C# Code

I typically code in VB.NET, but I'm going through a tutorial in C# .NET right now. I'm expecting to see a drop down list for selecting methods and properties at the top of the code file, right underneath the tabs for the code files I have open. However, I do not see these. If I open VB code, it works just fine. I've tried to look for an ...

How can I work around the __Canon type problem in generic exception handlers?

Given an extension method like this: Public Sub RehydrateTo(Of T As New)(ByVal input As String, ByRef output As T) Dim ms As MemoryStream = MsFromString(input) Dim f As New DataContractSerializer(GetType(T)) Try output = CType(f.ReadObject(ms), T) Catch ex As SerializationException output = New T Dim ild ...

LinqToSql - Multiple subqueries creates many roundtrips

I've got two tables that look like this: I'm trying to generate query that includes two specific StatisticsNames for each period from ApplianceStatisticsLog. Below is the Linq query I have come up with. It works but generates a single query for the first sub-select, then one additional query for EACH record for the 2nd sub-select. Ouc...

Why does enumerating through a collection throw an exception but looping through its items does not

I was testing out some synchronization constructs and I noticed something that confused me. When I was enumerating through a collection while writing to it at the same time, it threw an exception (this was expected), but when I looped through the collection using a for loop, it did not. Can someone explain this? I thought that a List ...

How to create Silverlight 3 Themes?

The new Silverlight 3 features page says: Developers can now theme applications by applying styles to their Silverlight 3 applications and changing them at runtime. But I can't find any information about this. I would like to create a theme for may app to define button styles/etc... Can someone let me know how to do this or point m...

decimals, ints, casting... oh my!

I'm going through the "Head First C#" book and in one of the chapters I created a program and uses variables declared as ints and decimals. Visual Studio got cranky with me a couple of times about mixing and matching the two. For example: dinnerParty.NumberOfPeople = (int) numericUpDown1.Value; NumberOfPeople is declared as an int an...

Hide another app's taskbar button

I would like to be able to hide another application's window from the taskbar, without hiding the window itself. Specifically, I want to have several different Web browsers running, visible, available in the Alt+Tab list, but not taking up space on the taskbar. (If anyone's curious why: I've written a dashboard app that uses Vista's Dwm...

Image Recognition Library

I wonder whether there is any competent image recognition library ( preferably open source) in .Net? I have an application that scans pages and documents in batches. In order to separate one document from another ( for these documents could have multiple pages), I plan to ask users to put a page, with a say, polar bear image on it to sep...

How do I refactor a WinForms application?

I'm going to bugfix a WinForms application (.NET 2.0) in the near future. Looking through the source code I find large code files (more than 2000 lines) most of them are generated dialogs with lots of code-behind. Has anyone tips for me to share? Any war stories or best-practices for bug fixing or refactoring WinForms applications? ...

Windows Forms in Unmanaged Code?

I find myself annoyed that Visual Studio comes with a fancy GUI interface designer and that it is only accessible to .NET applications and not even managed C++. Is there any easy way to at least open up a C DLL type interface with unmanaged/foreign code? ...

How can I Create a Subdomain on an IIS Server Using ASP.Net (Or C#)?

I want to create a website where users who sign up are able to get a subdomain on my main domain a la blogspot.com (ex. user.mywebsite.com) I really don't know how to get about doing this. I guess this will involve DNS. Here is some more info about my requirement. Don't need to set up an IIS website either. I want an app that would ro...

Returning HTML from JSON webservice - what is the ".d" ?

Hi This is one of those situations where I've had to pick up and run with a new tech without having time to learn the foundations! I have the following js function which calls out to PrintService, which returns me the HTML to inject into a div: function showPrintDialog() { $.ajax({ type: "POST", ...

Read .NET configuration from database

The .NET 2.0 and up configuration system is quite powerful and extensible - as long as you don't want to change the fact it all comes from XML files in the filesystem. In my requirement, I cannot change files since my app runs in a managed environment outside my reach - but I could change the SQL Server database. So I am looking at sto...

Why doesn't a SWF file in C# pause when using AxShockwaveFlash

Hi, I need to play various swf files in a C# application. They seem to start playing fine but trying to pause it has no effect the 1st time and whites out the panel if I try again. The code I'm using is below. Also rewind & forward have no effect. Any comments or help would be appreciated. David Knight namespace MyUI { public ...

C++/CLI: linker gives "unresolved token" for win32 function

Folks, I just created my first C++/CLI project (Visual Studio 2008), it's a Library to allow my C# app access an point of sale tally printer. My library builds well and trivial functions work when called from a C# exe. However as soon as I include a WinGDI call (DeleteObject in this case), the linker complains with “unresolved token” ...