.net

Moq - Ordered Setups (Expectations)

Hi All, I am fairly new to Moq and cant work out how I am to order setups. I have the following code: _orderRepository.Setup(r => r.Update(It.Is<Order>(a => ((int)a.OrderStatusReference.EntityKey.EntityKeyValues[0].Value) == 2))) .Throws(exception) .AtMost(5); I want this to be executed...

Is my project open-source if i use .NET langauges ?

I know VB.NET and i want to develop a program. Which i think later will be open-source if i fail to keep updating it. My question is : Is it possible to build open-source project by using .NET languages ? Or do i have to build open-source projects only using open source languages like Java,Ruby, Python etc ? ( I mean is there any restri...

Pass values from 1 aspx page to another?

What are the different ways to transfer values from 1 code behind page to another? Can hidden fileds work without form tag? I have 2 code behind pages. I need to transfer a particular value from 1 page and fetch in the other code behind page. What is the best method which can be followed under this situation? NB: Since the size of the s...

F# Operator Resolution

Hi, I have a class called Vector which implements a number of operators such as + and properties such as Count. Vector is also subtyped by classes such as DenseVector, SparseVector which inherit from Vector. Now in F# when I write the following let foo (v : #Vector) (w : #Vector) = v + w let bar (v : #Vector) (w : #Vector) = v.Count + ...

Is there a way to trigger a hardware refresh (aka Device Manager) using .NET?

I don't mind if it's only possible in the latest version of Windows, but I am wondering if there is a way to trigger this using .NET: ...

Visual Studio 2008 project not building after beign moved to a new machine

I moved one of my VS projects (C#) from one machine to another (SVN checkout) and when I'm trying to build it there I'm getting the following error: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. That doesn't give too much information about the nature of the problem. Th...

Null Reference in "SignFile" task when signing .Net manifest

I've written a .Net WCF Office 2007 app which uses ClickOnce as an installer. I'm using MSBuild via commandline to sign it, but I'm getting the following error: C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\OfficeTools\Microso ft.VisualStudio.Tools.Office.Office2007.targets(250,9): error MSB4018: T he "SignFile" task failed unexp...

When is the right time to say: "Now I need to create a user control!"

Hi guys, I wonder when do you consider to create a user control in .NET? Do you have some basic criteria to exclude your code from the page and introduce a new user control? Usually I tend to follow those to decide whether I need a user control or not: When the page seems to be more readable with a separate user control When some par...

why Windows Service crash?

Hello everyone, I am using VSTS 2008 + C# + .Net 3.5 to develop a Windows Service application. The code is very simple below, and I find when File.Copy throws exception (e.g. path not valid, no permission, etc.), the service will crash and pop-up a dialog to let me debug. My confusion is, I think unhandled exception of a thread created ...

Localization of a Form using ResourceManager

I am currently working on localizing a Form. However I am somewhat confused as to how one correctly does this. I thought it would be possible to export control properties to a resource file automatically, but it seems this is a manual task. My current approach is to add all the Control Properties which are of type String and are writab...

Where is the ClickOnce "Show Desktop Icon" option? (VS2008 SP1)

Hi~ Apparently in VS2008 SP1 there's an option under Publish | Options to have a desktop shortcut for ClickOnce, but I've got VS2008 with SP1 and there's no such option! My Publish Options page Any ideas? Thx! ...

ORM and .NET Code Protectors

We are about to use Code Protectors (Obsfucation as well as Native Compilation), I assume ORMs will be dependent little bit on Reflection and I am worried will Obsfucation and Native Compilation protection techniques create any problems? Has anyone tried successful ORM and Code Protection for any good desktop application? We are having ...

How do I use the service locator implementation in System.ComponentModel for dependency injection in a WinForms application?

I'm trying to allow my business logic components to query for services when they are added to one of my form/control classes. For example, I might have a ClientManager class in my library, which encapsulates some business logic. It requires an ILoginManager instance to query for some data that it needs to operate. The concrete ILoginMan...

How to execute a batch file on a remote computer?

I would like to be able to run a batch file on a remote computer after a build, where the build output and batch file are living on the build machine. In other words, i want the batch file that is running on the remote computer to be located on the build server, available through a UNC path. I've looked at WMI (System.Management) names...

couldn't open database

i have my c# application in c:\program files\app\ folder i am using sqllite database my code working perfectly while logging via windows administrative user, if i change window user account to limited, i couldn't open my database public void OpenDB() { SQConnectionString = "Data Source=" + DBPath +";Pooling=true;FailIfMissing=false"...

Running order of static code

I am working on a project using .Net mvc. I have a csharp class containing both a static constructor and some static filed. private static Class1 obj1 = new Class1(); private static Class2 obj2 = new Class2(); static Foo() { Init(); } private static void Init() { obj1.DoSomething(); obj2...

Squares-for-linebreaks missing in List view control. Why? .NET

This is not particularly a programming question, but I was hoping someone here may know the answer. We have in-house written application in C#. It's uses ListView control (i believe) to display a list of items - items/text that contains line breaks (newline chars). On most PCs (WinXP) the line breaks are displayed as two square characte...

How to make a .net application which is also a zip file?

I know this can be done. Can you show how to create a .net exe which also can be opened as a zip file with any zip file browser? ...

Hiding the PromptChar for .NET's MaskedTextBox

Is there a way to use MaskedTextBox without displaying the PromptChar? I would like to specify a mask to validate input against, but I don't want any prompt characters to take up space during edit mode. The reason for this is when I want to accept free text with a limited character set, all characters are optional alphanumerics. The pr...

Clean design and implementation for data import library

I have been given the task of developing a small library (using C# 3.0 and .NET 3.5) to provide data import functionality for an application. The spec is: Data can be imported from CSV file (potentially other file formats in the future) The CSV files can contain any schema and number of rows, with a maximum file size of 10MB. It must...