.net

Run Windows Forms application as service?

I have a Windows Forms application that I wrote that does some monitoring of an inbox and database. The customer has informed me that it needs to run every time the server reboots. Shame on me for letting the customer change the requirements. I was thinking ... is there any way to make a Windows Forms application run as a service so t...

ASP.NET MVC Release Date

Does anybody know if there is an official or estimated release date for the ASP.NET MVC framework? I'm starting on a project that I hope to have completed by mid March and it would be a perfect candidate for the platform, but I don't want to release it under a framework that isn't completed. ...

Can you change a master page's ContentPlaceHolder's Content Page Asynchronously in .NET?

From what I've already read this appears to be impossible, but I wanted to see if anyone out there has a secret trick up their sleeve or at least a definitive "no". Supposedly a master page is really just a control for a content page to use, not actually the "master" of a content page. If I wanted to go from one content page, to anot...

Type.GetType() for a class that resides in an unreferenced assembly

GetType() returns null when the type exists in an unreferenced assembly. For example, when the following is called "localType" is always null (even when using the full namespace name of the class): Type localType = Type.GetType("NamespaceX.ProjectX.ClassX"); I don't see any reason why Type.GetType shouldn't be able to retrieve a type...

Get full quality 16 x 16 icon using Icon.ExtractAssociatedIcon and ImageList

Following the directions at this question, I have some code running to extract icons from files and display them in a ListView set to details mode. I want to icons to display at 16 x 16, but when I have the ImageList size set to that the icons that come out look very weird (not sure how to describe it - see attached screenshot). I've tr...

How do I make a textbox that only accepts numbers?

I have a windows forms app with a textbox control that I want to only accept integer values. In the past I've done this kind of validation by overloading the KeyPress event and just removing characters which didn't fit the specification. I've looked at the MaskedTextBox control but I'd like a more general solution that could work with pe...

ArgumentNullException or NullReferenceException from extension method?

What would you consider to be the best exception type to throw when an extension method is called on a null instance (where the extension method does not allow it)? Since extension methods are nothing but static methods you could argue that it should be ArgumentNullException, but on the other hand they're used like instance methods so it...

What's the best way to cache data in a C# dll?

I've written a DLL that may be used in a number of ways (referenced by ASP.NET web sites, WinForms, etc.). It needs to load its data from several delimited files that will be automatically updated on a semi-regular basis. For performance reasons, I'm loading the data into a static object (a generic List), and only want to go back to th...

How to dynamically refresh a .NET databound repeater control

I have a .NET repeater control that is data-bound to a List. As part of the Repeater's ItemCollection, I have a "Remove Button" that effectively removes this current List element. This works, in code-behind I can successfully remove an item from the datasource of the Repeater. My problem is this : when I reset the updated datasource ...

Delete Single Message MSMQ

Hi Is it possible to delete a single message from a MSMQ message queue ? I have a Queue object, a message (object) that I have got to by peeking and the ID of the message, I can see a way of deleting (or purging) the entire queue, but I can't see a way to delete the message on it's own, I've tried receiving the message once I have found...

Methods, Interfaces, Reflection and a difficult OOP design

I'm not quite sure how to explain this (that's why the title is kinda weird) but I'll have a go. Basically I'm doing some Oject-Oriented Design and I want to represent various different types of object, each of which can have various actions which it can perform. An example might help: things such as a File which can have delete, rename ...

Troubleshoot a 'Sys' is undefined message in my upgraded web application

I have a web application that was originally written on .Net 1.1 Framework. I have since tried you upgrade it to .Net 3.5 Framework. I am now getting this javascript error throw on my page and for the life of me can't figure out exactly why. I have target the application for the .Net 3.5 framework, and even deleted and added back in th...

Java and other clients for WCF RESTful Services

I am wanting to expose some data service endpoints for internal application use and am debating on WCF REST as a possible solution. What are my options for other languages/platforms as clients? Keeping in mind that I need to service Java, Python and .Net clients. Essentially, I want to be able to demonstrate a single point of organ...

Singleton with finalizer but not IDisposable

This is what I understand about IDisposable and finalizers from "CLR via C#", "Effective C#" and other resources: IDisposable is for cleaning up managed and unmanaged resources deterministically. Classes that are responsible for unmanaged resources (e.g. file handles) should implement IDisposable and provide a finalizer to guarantee th...

How do you tap into MYOB from a .NET app?

I'm interested in finding out how to interface a .NET app (or even just about any app running on any platform, maybe even Java or PHP) with MYOB. There's a system already in place that uses MYOB but the business owner wants their different branch offices to be able to interact with each other. I would be really interested to know the pos...

Getting value of a property in Parent User control from a Child user control

I have a ChildUserControl that is loaded inside a ParentUserControl. The host page loads ParentUserControl. I would need to access properties in ParentUserControl from the ChildUserControl. Thanks for your time ...

Complex databinding to DataGridView header text

Is there a way to complex databind to a column's header text? Or is the only way to manually set the values and listen for change events from the source? For the record, I've tried both MyDataGrid.DataBindings.Add("Columns[<columnIndex>].HeaderText",MySource,"MyProperty"); and MyDataGrid.DataBindings.Add("Columns[\"ColumnName\"].Hea...

.Net PostgreSQL Connection String

I am using PostgreSQL in a project I am working on, and one of the queries is timing out. I need to increase the timeout on the database connection, but since I am using my DAO through a complex wrapper to Active Record and NHibernate, I am not able to adjust the timeout of the command object - so I am hoping you can change the timeout ...

How significant is .NET 3.5 SP1 for WCF/REST?

I just worked through a book on WCF and was surprised that it didn't even mention REST at all. Was REST an afterthought for WCF that was added in .NET 3.5 SP1 and hence not baked in well or is it well integrated? I assume that Silverlight and XBAPs can consume WCF with no problem or do they have some limitation due to their sandbox env...

What is the best source control system for a solo programmer using Visual Studio 08?

I writing a C# App for a customer for the first time and I am not sure what to do about adopting a version control system. My version control system is soley composed of making full copies of the source code every day so I never lose more than a day of work. I would like to do something less primitive going forward. Which source c...