.net

How should I write code with unique sections for different versions of .NET

My source code needs to support both .NET version 1.1 and 2.0 ... how do I test for the different versions & what is the best way to deal with this situation. I'm wondering if I should have the two sections of code inline, in separate classes, methods etc. What do you think? ...

C# component do not refresh when source code updated

Hello, I have a solution with many projects. One project contain few custom components. One of these components is used to display a title on an image. We can change the color of the background and many other things. The problem is IF I decide to change the default color of the background of the component or change the position of the ...

Multiple Forms and a Single Update,Will it work?

I need to make an application in .NET CF with different/single forms with a lot of drawing/animation on each forms.I would prefer to have a single update[my own for state management and so on] function so that i can manage the different states, so that my [J2ME Gaming Code] will work without much changes.I have came to some possible sc...

Why I get an "Canvas does not allow drawing" while drawing in TeeChart ActiveX 5 component?

I'm using Steema's TeeChart ActiveX 5 component for an application in .NET C#. I do some drawings using the methods Line(), Rectangle() and Circle() through the "Canvas" property of the component. My code for drawing is called on every on every OnBeforeDrawSeries() and OnAfterDraw() events of the component. When there is only a few dr...

What's the best way to get the default printer in .NET

I need to get the default printer name. I'll be using C# but I suspect this is more of a framework question and isn't language specific. ...

Help getting .Net WinForms apps to support Vista Aero Glass.

There are a couple of tricks for getting glass support for .Net forms. I think the original source for this method is here: http://blogs.msdn.com/tims/archive/2006/04/18/578637.aspx Basically: //reference Desktop Windows Manager (DWM API) [DllImport( "dwmapi.dll" )] static extern void DwmIsCompositionEnabled( ref bool pfEnabled ); [D...

How do I upload a file to an SFTP server in C# / .NET?

Does this capability come with .Net? If not, what's the best free library? I need something that will throw good exceptions when there is a problem, and allows me to monitor its progress. ...

Reading changes in a file in real-time using .NET

I have a .csv file that is frequently updated (about 20 to 30 times per minute). I want to insert the newly added lines to a database as soon as they are written to the file. The FileSystemWatcher class listens to the file system change notifications and can raise an event whenever there is a change in a specified file. The problem is t...

How to Modify config file on clickonce deployment?

I have a application deployed through clickonce, but How can I modify the config file on the deployment server?. I mean, once the product is tested, it should be deployed in our production server, but need to modify some of the config parameters to consume production resources?. I heard we should use MageUI.exe, but still not sure. I ...

Best Library for Dynamic PDF or Word Doc Generation?

Our ASP.NET application must be able to export web content to PDF and Word documents. In the past, we've used Aspose's libraries to accomplish this, but we've found them to be a little too low-level in terms of document construction. e.g. We've found ourselves needing to write point-based functions using shape primitives to create bulle...

Does DataGrid on CE 5.0 Compact Framework .NET support editing?

I am trying to get a DataGrid under CE 5.0 / .NET CF 2.0 that a user can edit. The document at http://msdn.microsoft.com/en-us/library/ms838165.aspx indicates that some environments do not support editing - As there is no native support for editing in the DataGrid control, this needs to be implemented manually Do I need to im...

Some sort of creational pattern needed in C#

I have the following type : // incomplete class definition public class Person { private string name; public string Name { get { return this.name; } } } I want this type to be created and updated with some sort of dedicated controller/builder, but I want it to remain read-only for other types. This object als...

How to properly handle exceptions when performing file io

Often I find myself interacting with files in some way but after writing the code I'm always uncertain how rubust it actually is. The problem is that I'm not entirely sure how file related operations can fail and, therefore, the best way to handle expections. The simple solution would seem to be just to catch any IOExceptions thrown by ...

How to avoid thousands of needless ListView.SelectedIndexChanged events?

If a user select all items in a .NET 2.0 ListView, the ListView will fire a SelectedIndexChanged event for every item; rather than firing an event to indicate that the selection has changed If the user then clicks to select just one item in the list, the ListView will fire a SelectedIndexChanged event for every item that is getting unse...

Same source code on two machines yield different executable behavior

Here's the scenario: A C# Windows Application project stored in SVN is used to create an executable. Normally, a build server handles the build process and creates builds at regular intervals which are used by testing. In this particular instance I was asked to modify a specific build and create the executable. I'm not entirely sure ...

Avoiding double-thunking with C++/CLI properties

I've read (in Nish Sivakumar's book C++/CLI In Action among other places) that you should use the __clrcall decorator on function calls to avoid double-thunking, in cases where you know that the method will never be called from unmanaged code. Nish also says that if the method signature contains any CLR types, then the JIT compiler will ...

Query Web Service for list of Messages?

Is there a straightforward way to query a web service to see which messages it supports? The C# .NET application I'm working on needs to be able to handle an older version of the web service, which does not implement the message I'm trying to send. The web service does not expose a version number, so Plan B is to see if the message is de...

C# ListView mouse wheel scroll without focus

I'm making a WinForms app with a ListView set to detail so that several columns can be displayed. I'd like for this list to scroll when the mouse is over the control and the user uses the mouse scroll wheel. Right now, scrolling only happens when the ListView has focus. How can I make the ListView scroll even when it doesn't have focus...

.NET library for processing HTML e-mails & stripping previous responses

Does anyone know of a .NET library that will process HTML e-mails and can be used to trim out the reply-chain? It needs to be able to accept HTML -or- text mails and then trim out everything but the actual response, removing the trail of messages that are not original content. I don't expect it to be able to handle responseswhen they'r...

ASP.NET UrlRewriting and Constructing Page Links

So this post talked about how to actually implement url rewriting in an ASP.NET application to get "friendly urls". That works perfect and it is great for sending a user to a specific page, but does anyone know of a good solution for creating "Friendly" URLs inside your code when using one of the tools referenced? For example listing a...