.net

How can I create my custom Shell Context Handlers for Windows?

Problem Language: C# 2.0 or later I would like to register context handlers to create menues when the user right clicks certain files (in my case *.eic). What is the procedure to register, unregister (clean up) and handle events (clicks) from these menues? I have a clue it's something to do with the windows registry, but considering...

Best practice for translating exceptions in C++/CLI wrapper class

I am writing a .NET wrapper class for an existing native class which throws exceptions. What are the best practices for translating between native C++ exceptions and Managed exceptions? Catch and re-throw on a one-to-one basis (e.g. std::invalid_argument -> System.System.ArgumentException)? Is there a mapping already drawn up somewhere? ...

What Could Affect Values Returned By Serialport.Read()

I've written a simple app in C# 2.0 using the .Net Framework 2.0 Serialport class to communicate with a controller card via COM1. A problem occurred recently were the bytes returned by the Read method are incorrect. It returned the right amount of bytes, only the values were incorrect. A similar app written in Delphi still returned the...

What is the OleDb equivalent for INFORMATION_SCHEMA

In SQL you can use SELECT * FROM INFORMATION_SCHEMA.TABLES etc to get information about the database structure. I need to know how to achieve the same thing for an Access database. ...

log4net vs Enterprise Library, which is better? faster?

Anyone know of some performance comparisons of the latest version Enterprise Library and the latest version of log4net? Any technical reason why I should choose one over the other? ...

C# - Why won't a fullscreen winform app ALWAYS cover the taskbar?

I'm using Windows Vista and C#.net 3.5, but I had my friend run the program on XP and has the same problem. So I have a C# program that I have running in the background with an icon in the SystemTray. I have a low level keyboard hook so when I press two keys (Ctr+windows in this case) it'll pull of the application's main form. The for...

Getting Socket closed error when a remoting exception is thrown on the server

Hello, I have an app that is built using .Net remoting. When authenticating, If there is an error, I threw an exception on the server. The exception is serializable. But when the exception is thrown on the server, Sometimes I see an error on the client side that says "An established connection was aborted by the software in your host ma...

How to "Open in New Window" using WebBrowser control?

When you use the WebBrowser control in .NET you can "embed" an instance of IE in your application, essentially making your own IE-based Web Browser. Does anyone know how to make any new windows created (like when the user selects "Open in New Window" from the context menu) open up in another Window of Your Web Browser Application, inste...

Good .NET ORM Framework that supports OleDb and Stored Procedures?

A typical stored procedure in our system accepts around 20 or so parameters. There's no chance of refactoring these stored procedures either. I've basically resorted to writing my own code generator that wraps these SP's into (database provider agnostic) "Command" objects, with their public properties corresponding to the SP parameters...

Long-running code within asp.net process

E.g. we this code in the asp.net form codebihind: private void btnSendEmails_OnClick() { Send100000EmailsAndWaitForReplies(); } This code execution will be killed by the timeout reason. For resolving the problem I'd like to see something like this: private void btnSendEmails_OnClick() { var taskId = AsyncTask.Run( () => Send...

RTF control for .Net 1.1 Windows

Can anyone recommend a cheap and good RTF control for .Net 1.1 Windows development. It needs to be able to do print/preview and some basic text formatting, fonts etc but nothing too advanced. Cheers Andreas ...

Horrible redraw performance of the DataGridView on one of my two screens.

I've actually solved this, but I'm posting it for posterity. I ran into a very odd issue with the DataGridView on my dual-monitor system. The issue manifests itself as an EXTREMELY slow repaint of the control (like 30 seconds for a full repaint), but only when it is on one of my screens. When on the other, the repaint speed is fine. I h...

What's so wrong about using GC.Collect()?

Although I do understand the serious implications of playing with this function (or at least that's what I think), I fail to see why it's becoming one of these things that respectable programmers wouldn't ever use, even those who don't even know what it is for. Let's say I'm developing an application where memory usage varies extremely ...

Iron python, beautiful soup, win32 app

Does beautiful soup work with iron python? If so with which version of iron python? How easy is it to distribute a windows desktop app on .net 2.0 using iron python (mostly c# calling some python code for parsing html)? ...

How do I effectively persist a .Net font object ?

Usecase: The user makes font customizations to an object on the design surface, that I need to load/save to my datastore. I.e. settings like Bold, Italics, Size, Font Name need to persisted. Is there some easy (and reliable) mechanism to convert/read back from a string representation of the font object (in which case I would need just o...

Add row while assigning datasource for datagridview

I have a datagridview assigned a datasource to it. now how to add a new row to that grid and remove a row from it? ...

In .Net, what is the fastest way to recursively find all files from a root directory?

I want to search a directory for all files that match a certain pattern. Surprisingly, I have not had to do this since vb6 (Dir)... I'm sure things have changed since then! -Thanks ...

Position the caret in a MaskedTextbox

I would like to be able to override the default behaviour for positioning the caret in a masked textbox. The default is to place the caret where the mouse was clicked, the masked textbox already contains characters due to the mask. I know that you can hide the caret as mentioned in this post, is there something similar for positioning ...

Getting Security Headers into a WCF service with custom message/formatter in .NET 3.0

We've inherited a WCF web service that has a custom MessageFormatter that constructs a custom Message subclass in the SerializeReply Method. class OurMessageFormatter : MessageFormatter { public Message SerializeReply(MessageVersion messageVersion, object[] parameters, object result) { OurResponse ourResponse = (OurResponse) res...

Is it possible to determine the current user from within a global keyboard hook in .NET

I want to create a keyboard and mouse hook which will be started as a windows service. I want to monitor the activity of the various users who use the system throughout the day. i.e. which users are active at what times. Is is possible to determine which user will be receiving the events? (The service will be running as a separate user ...