.net

.Net Threading Problem

Here is my code: ThreadStart threadStart = controller.OpenFile; Thread thread = new Thread(threadStart); thread.Start(); In the OpenFile function my code looks like: System.Console.Error.WriteLine("Launching"); The code in OpenFile doesn't get executed for 30 seconds exactly. It starts immediately on my machine but in our producti...

using statement vs try finally

I've got a bunch of properties which I am going to use read/write locks on. I can implement them either with a try finally or a using clause. In the try finally I would acquire the lock before the try, and ralease in the finally. In the using clause, I would create a class which acquires the lock in its constructor, and releases in its...

working with incredibly large numbers in .NET

I'm trying to work through the problems on projecteuler.net but I keep running into a couple of problems. The first is a question of storing large quanities of elements in a List<t>. I keep getting OutOfMemoryException's when storing large quantities in the list. Now I admit I might not be doing these things in the best way but, is the...

Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80080005

What is the troubleshooting process for the "Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80080005" errors in .Net? To clarify: I am getting this at runtime, on my XP machine, with client being .net code running under admin account. {XXXX} refers to one of our in-house COM components...

How to use StreamReader in C# (newbie question)

I'm trying to read the contents of a text file, in this case a list of computer names (Computer1, computer2 etc,) and I thought that StreamReader would be what you would use but when I do the following: StreamReader arrComputer = new StreamReader(FileDialog.filename)(); I get this error: The type or namespace name 'StreamReader' coul...

Anyone Know a good tutorial of how Crystal Reports for Visual Studio works?

I am stuck building reports that will be generated by a custom application using the Crystal Reports 9.1.5 that comes with Visual Studio 2003. In addition to the editor being one of the most infuriating things I've ever had to work with I am also constantly hounded by the various gotchas having to do with their code generation engine. ...

Is there a better way to compare general performance of .Net and Java in an eCommerce setting than the "pet store"?

Hi, I've been using the Java Pet Store and .Net Pet Store examples for years when comparing JEE and .Net performance in an eBusiness type setting. Is there a better way to compare the performance of JEE and .Net for this type of application? Update: As some have pointed out below, the implementation, framework versions, architecture...

How can I get a collection of all the colors in System.Drawing.Color?

How can I extract the list of colors in the System.Drawing.Color struct into a collection or array? Is there a more efficient way of getting a collection of colors than using this struct as a base? ...

Determine whether user is logged in

What's the best/most efficient way whether the user of my .NET web application is currently logged in. I'm currently using Membership.GetUser() != null, but now that I realize that this involves a DB-roundtrip, I wonder if there's a better way. Maybe HttpContext.Current.User.Identity.IsAuthenticated? ...

An object reference is required for the non-static field, method, or property

Ok. I'm having an issue with the following bit of code: StreamReader arrComputer = new StreamReader(FileDialog.FileName); My first question had been answered already now my second question focuses on the tail end of this code. I'm reading a text file StreamReader that the user selects with a button event using OpenFileDialog priva...

Resend to MSMQ after exception

I'm trying to put a Message back into an MSMQ when an exception is thrown. The following code appears to work but the Message is not put back in the queue? Message msg = null; try { MessageQueue MQueue = new MessageQueue(txtMsgQPath.Text); msg = MQueue.ReceiveById(txtQItemToRead.Text); lblMsgRead.Text = msg.Body.ToString(); ...

How do I use .Net reflection to search for a property by name ignoring case?

I had the following line snippet of code that searches for a propery of an instance by name: var prop = Backend.GetType().GetProperty(fieldName); Now I want to ignore the case of fieldName, so I tried the following: var prop = Backend.GetType().GetProperty(fieldName, BindingFlags.IgnoreCase); ... No dice. Now prop won't find field...

How do you check for ajax updates using a WebBrowser control in .net 2.0?

I have a web page that is being displaying in a winform app using the WebBrowser Control. I need to perform an event when the HTML in the web page changes; however, I cannot find an event that is triggered for situations when the pages is updated through Ajax. The DocumentComplete, FileDownloaded, and ProgressChanged events are not alway...

.Net - interop assemblies taking 15 seconds to load when being referenced in a function

This is a C# console application. I have a function that does something like this: static void foo() { Application powerpointApp; Presentation presentation = null; powerpointApp = new Microsoft.Office.Interop.PowerPoint.ApplicationClass(); } That's all it does. When it is called there is a fifteen second delay be...

Debugging C# Custom Installer Classes

I have written an installation class that extends Installer and overrides afterInstall, but I'm getting a null pointer exception. How can I got about debugging my class? ...

Email Notification Service

What are some ideas (using .NET and SQL 2005) for implementing a service that sends emails? The emails are to be data-driven. The date and time an email is to be sent is a field in a table. ...

Calculating the minimum width needed to show text in X lines, in .Net?

How could you calculate the minimum width needed to display a string in X lines, given that text should break on whitespace? ...

How do I keep the WPF GridSplitter from changing the size of my Grid?

WPF GridSplitter makes my Grid wider than my Window! I've got a WPF Grid with a GridSplitter. If I resize my columns, then I can make my grid wider than my window and non-viewable. It starts like this: But after widening the left column, I can no longer see the right column (green): What am I doing wrong? How do I keep the ...

Switching off the .net JIT compiler optimisations

Hi there. I have a curly one here. When we remote a method (that is using generics) the remoting sink cannot seem to discover our method from the other identical named ones. Debugging with .net source code attached I've got it to where there is a MethodInfo. MakeGenericMethod call. However I cannot look at any of the surrounding data as...

Issue when using Visual Studio Report Designer with Linq to SQL datasource

I don't expect to get a great response from this, so if you have had experience in this any contribution would be appreciated. I am trying to use the Visual Studio Report Designer with a Linq to SQL datasource, I have no experience of using the Visual Studio Report Designer. If I go through the wizard and use an object datasource I can...