.net

Disable and Enable Screen Saver in Windows 7

I have an application than disables the screen saver temporarily in order to run a slide show. I use this to turn it on or off: i = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, active, Nothing, SPIF_SENDWININICHANGE) This works fine in XP. In Windows 7, it disables the screen saver properly. However, when it is enabled again, at the ...

CultureAndRegionInfoBuilder doesn't exist

Okay, this is a strange one. I'm trying to create a custom culture using: using System.Globalization; ... var x = new CultureAndRegionInfoBuilder(); But I get the nasty red Resharper error with no options. The type or namespace name 'CultureAndRegionInfoBuilder' does not exist in the namespace 'System.Globalization' What's going ...

Targeting .NET 2.0 solution with SCSF-CAB

My team is starting a new LOB WinForms app and I'm evaluating architectural solutions. We are able to develop with VS2008, but we have to target .NET 2.0. I'd like to use SCSF-CAB (April 2008), but the documentation says that .NET 3.5 is required to run (not just compile) apps built with this framework, and that is crux of my question: ...

BackgroundWorker Question

I would like to use the BackgroundWorker to perform a db transaction from a GUI. How can I command the BackgroundWorker to perform the work and then WAIT for the worker to complete while keeping the GUI responsive? Do I have to use DoEvents for this purpose, or is there another way? ...

Expression.GreaterThan fails if one operand is nullable type, other is non-nullable

I am creating some dynamic linq and am having problems with the following exception: The binary operator GreaterThanOrEqual is not defined for the types 'System.Nullable`1[System.DateTime]' and 'System.DateTime' I get why, because my field type is nullable and Im passing in DateTime.Now essentially. So in trying to resolve t...

Simple Regex Help

How can I match strings without a dot in regex, for example, these should be matched: a/b אאא/תתת a b c ג 123/1 but these shouldn't: abc.asp ddd.css style/main.css For .NET Syntax. Thank you. ...

System.Xml.Xsl: How to redirect output produced by xsl:message elements to my trace listeners?

I know about Console.SetOut, but can't figure out what I should pass to this method. ...

C# public type alias?

What I want to do is write some classes in C# in a new namespace that act as wrapper classes for classes in another namespace. Sometimes a wrapper class is not needed but I still want a corresponding class in the new namespace. And I want an exact copy of the class. Is there a way to define the class in the new namespace by referring ...

recommended commenting tool / add-in for Visual Studio >

Which tools you use and why for automatic documentation / comments generation with Visual Studio ...

Login to two different pages according to roles

My project has a Guest folder and an admin folder. Guest has a guest1.aspx page and admin has admin1.aspx page. Now I am trying to figure out a login control which will check the role of the user and send them to the respective pages accordingly. The names are not in the database or the active directory... These names are on the wind...

Building C#/.NET Apps that Use Windows 7 TaskBar Features

The new Windows 7 taskbar features, like jump lists, previews, etc. are really cool, and I want to allow my C# applications to use them. I have two questions: First of all, how can I use these functions (in general)? I found two articles by Microsoft about this, but I'm not really sure what to do. Could you provide links to a library, a...

How to pass all selected files names to C# application ?

Hi, I would like to select several files on my desktop (or any other folder) and pass their names to my application. More specifically, I've added a key to the registry such that when I right click on a jpeg file I see a new "Transform" option that actually runs my application. The question is how can I pass all selected files names to...

PHP vs .NET JSON web service

My iPhone app communicates with a RESTful service that provides JSON output. I've been generating JSON using mainly PHP. If I use a .NET web service or WCF service, will there be any limitations or differences I should be aware of in regards to JSON as input/output for the service? I'm not sure what to expect from .NET in this regard....

Great example of development architecture

I am looking for a sample application which shows off good to great use of architectual patterns, so far I found TailSpin DinnerNow The problem with the above is that the requirements to get this up, make it a nightmare to work with. My requirements list is it should be simple to get up and running, covers the basics and does need...

Exception occuring while using T Field<T> in my code.

I am getting InvalidCastException when i am trying to use this code. I am not been able to resolve how to use Field. Plz help me out DataTable _Transaction= new DataTable(); float NetAmount=0; //Records inserted into Table for (int i = 0; i < _Transaction.Rows.Count; i++) { NetAmount += _Transaction.Rows[...

Memento Implementation in VBA

Hi, I'm looking for a VBA implementation of the Memento pattern (GoF). I'm looking at converting the Java version from Wikipedia. It will be used for Undo/Redo functionality for an Excel add-in. Specifically, I am having difficulty with the line: return new Memento(state); Or, to make it more specific, can someone rewrite this in VB...

Redirecting to a Web Page from a Web Service call

I have a .net web service that takes some xml data. From within the web service, I want to manipulate the data and then call a web page that displays information to the user. The web service should return after spaning the web page. I am not having any luck doing this. I have tried Server.Transfer(url, end); Which generates th...

How can i get the path to the common Desktop and Start Menu dirs in C#?

I'm using .NET 2.0. I noticed that there doesn't seem to be a Environment.SpecialFolder member for the common Desktop and common Start Menu folders. i would prefer a way that doesn't involve loading shell32.dll and using SHGetSpecialFolderPath ...

admin folder permissions.. not allow guests

I have a membership web application. A user is either an administrator or a guest user (only 2 roles) I have an admin folder and a guest folder in this application. I want administrators to access both folders and guest not to access Admin folder. I am not using the .net member/role/profile framework. What's the easiest way to secure ...

LINQ InvalidCastException error

Hi, I'm getting "InvalidCastException" (occurred in System.Data.Linq.dll) in my function: public User GetUserByKey(Guid key) { return usersTable.FirstOrDefault(m => m.UserKey == key); } which is called here: MembershipUser mu = Membership.CreateUser(user.UserName, user.Password, user.Email, null, null, true, Guid.NewGuid...