.net

Display Windows character map applet?

What's the best way to display Windows' character map applet from my .NET (C#) application? I know it's an optional component, so I want to display a message to the user if they don't have it installed. I've tried using ShellExecute( 0, "OPEN", "charmap.exe", "", "", 0 ); but all that happens is my app loses focus and character map ...

Use a .jar java library API in C#?

Hello, I'm an entry level programmer so please bear with me and be descriptive in your responses. I am trying to use a Java API given as a .jar file in my C# .net application. I don't know much Java, but this .jar file says "no main-class manifest attribute" when I try to run it so this means its a library? This Java API also comes w...

NullReferenceException when using Linq to XML

Given this xml document: <projects><project><name>sample project</name><location>http://somewhere.com/&lt;/location&gt;&lt;/project&gt;&lt;/projects&gt; And this linq to xml statement for retrieving name/location elements and creating a new Project object: return xmlDocumentFromAbove.Descendants("project").Select(p => new Project(p.E...

New-fangled "view statistics" not working on upgraded CruiseControl.NET server

Recently I upgraded a couple of CruiseControl.NET server from version 1.3 to version 1.4.2.14. After the upgrade I was pleased to note that the "View Statistics" link from the project's web dashboard sported a new view: However, I was quite disappointed to discover that another server that I upgraded in an identical way sported the ...

Declarative thread safety in .NET

Hi, I need to make an existing app thread safe. Due circumstances (see below), I decided to use one single ReaderWriterLock for the entire graph of business objects. All methods/properties must look like these: public int MyReadOperation(string inputParam) { rwLock.AcquireReaderLock(10000); try { // do all read operation...

How to determine which control on form has focus?

Hi, I've read elsewhere on here that to capture "Enter" key stroke in a text box and use it as if pushing a button I should set the KeyPreview property of the form to true and check the value of KeyDown. I want to be able to use this functionality on several TextBox controls which each are associated with a different Button. My quest...

Generic Cache mechanism for .NET

I've got a class library which has a Person class. The Person class includes a property for CountryName and CountryCode. The CountryCode is the value stored in the Person table. The CountryName is retrieved from an accompanying lookup table. Because the mapping between CountryName and CountryCode is not likely to ever change, I feel ...

.NET: Animation common control for .NET?

Did Microsoft not provide a managed wrapper around the Animation common control for .NET developers? ...

.NET Bootstrap without setup

I have a .NET WinForms application which needs to be run from CD. What I need to figure out is if user has required .NET version installed or install if necessary than run the application after installation. Any info I've found about bootstrapping involves setup and installation of the application. How can I do this if I don't install an...

Explaining .NET or Java to a client

At my company we develop applications that run on the JVM (JEE and Grails) as well as .NET applications (ASP.NET and client/server Forms apps). In your experience, when have you recommended one over the other to a customer? I asked this question incorrectly here but I think the fact that I put an initial list got it closed. I'm looking ...

Is there a way to measure the the amount of a string that will fit into a printed area without using the graphics object?

Is there a way to measure the the amount of a string that will fit into a printed area without using the graphics object? This is the only way i could find to do it: Graphics instance = this.CreateGraphics(); instance.MeasureString(text, f, printArea1, StringFormat.GenericDefault, out end, out lines); I am using .net 2.0 and c#...

pinvoke: uncertain how to work with dllimport and imported libraries

I am doing a dllImport on a C++ dll and I have the following signature. StackOverflow has been very helpful so far, so I thought I'd throw this one and see what I get. Are there any gotchas that I should be worried about? This is my first time using dllimport. I need to import the following to C#: HANDLE FooInit(char* name); //na...

Looking for a faster DataGridView (or equivelent)

I have a large table and loading the DataGridView is very slow. The table is going to get bigger. Is there a way to optimize the loading? Is there a good replacement control? (We will purchase one if need be.) Is there an option I haven't thought to ask? ...

Abstract Enum selection box

I'm trying to make a function that can take an enum type, display all the possible selections to the user, let them select one and then pass it back. Generics don't allow you to limit to enum. I've got code working that will cast back and forth, but I'd like it to accept and return the same enum type. This code works but not as well as ...

Programmatic MSIL injection

Let's say I have a buggy application like this: using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.WriteLine("2 + 1 = {0}", Add(2, 1)); } static int Add(int x, int y) { return x + x; // <-- oops! } }...

Bound Textbox to a currency, how to get the double?

I have a textbox bound to a currency data field. So it adds '$' to the start of the text or ($xx.xx) if it's negative. How do I get just the plain double (xx.xx) from the textbox instead of everything ($xx.xx)? ...

Overloading methods in C# .NET

A variable of the type Int32 won't be threated as Int32 if we cast it to "Object" before passing to the overloaded methods below: public static void MethodName(int a) { Console.WriteLine("int"); } public static void MethodName(object a) { Console.ReadLine(); } To handle it as an Int32 even if it is cast to "Object" can be achieved ...

WPF How to use the same template

Well how do i use a template on the TextBox and the PasswordBox atm i have 2 templates defined but thay contain exactly the same content.... ...

How can you detect when the user clicks on the notification icon in Windows Mobile (.NET CF 3.5)

Surfing the net, I came across this: this code that shows how to display a notification at the bottom of the screen on a Windows Mobile device. My question is, is there a way to either specify which options are displayed beneath the notification (on the taskbar) or is there a way to detect when the user clicks on the notification itself...

What are the fast reporting solutions that work with .Net?

I'm looking for fast reporting services that are compatible with .Net (C# specifically). Additionally since many of these companies are coy about their pricing (e.g. Cognos) it would be helpful to know how expensive they tend to be. We are doing serial reporting to PDF and Excel from a SQL Server 2005 database. Specifically because of t...