.net

Modifying the MouseWheel behaviour of a Combobox

I have a UserControl containing TextBoxes and ComboBoxes and this UserControl is contained in a Panel with AutoScroll set to True. When a textbox has the focus and I scroll with the mouse wheel, then the panel scrolls, when a combobox has the focus and I scroll with the mouse wheel then the selected item in the combobox changes. I'm su...

What's wrong with this linq query??

I'm sure it's something really stupid, but I just don't see it.. pData.LocationHours is of type BaseLocationHoursDataSet.LocationHoursDataTable. Yet when I hover the cursor over l, all I see is "(range variable) TSource l" - why is that?? Why doesn't linq know what it's dealing with? I try the same thing with a different DataTable a...

How do you provide JSON response data in .NET?

Without using any third party tools, what is the ideal way to provide JSON response data? I was thinking of having an ASPX application page to just return the json string response. Any ideas? ...

Ensure streamreader doesn't hang waiting for data

The code below reads everything there is to read from tcp client stream, and on the next iteration it will just sit there on the Read() (i'm assuming waiting for data). How can I ensure it doesn't and just returns when there's nothing there to read? Do I have to set low timeout, and respond to an exception when it fails out? Or there's a...

WCF: How can I programatically recreate these App.config values?

Hi, I have a WCF service that works ok if I create the service without specifying any binding or endpoint (it reads it from the generated values in the App.config when I registered the WCF via Visual Studio). I have a simple method that returns the service reference: return new SmsServiceReference.SmsEngineServiceClient(); This work...

Can AddIns in MAF (System.AddIn) have constructor parameters?

I need to pass configuration settings to an AddIn created using the Managed AddIn Framework (MAF, aka System.AddIn). Can a put a settings parameter in the AddIn's constructor? Another option would be to create an Initialize() method, but then I have to remember to call it before doing any work with the AddIn. ...

A Security (encryption) Dilemma

I have an internal WPF client application that accesses a database. The application is a central resource for a Support team and as such includes Remote Access/Login information for clients. At the moment this database is not available via a web interface etc, but one day is likely to. The remote access information includes the usernam...

Client configuration to consume WCF JSON web service

Hi, I have configured the web service to use Json as described on this blog: http://www.west-wind.com/weblog/posts/164419.aspx and various other blogs, but I couldn't create a client to consume this service. I tried various things, but invariably I got meaningless exceptions. What is the correct way to implement the (WCF I should add) c...

Powershell Calling .NET Assembly that uses App.config

Hi, I have a Powershell script that is loading a .NET assembly (.EXE in my case) and calling a public method that uses the app.config to pull an encrypted connection string. The script dynamically copies the assembly's exe.config over to the Powershell ($pshome) folder as powershell.exe.config and is able to run from my development box...

.Net 1.0 and 2.0 hybrid application

I have a .Net app with dll's that some of them were compiled with .Net 1.1 and some with 2.0. How does such an application work - isn't there only one runtime for an application? If so which is it? If not how are objects being passed between the runtimes? ...

How to make a .NET process run out of memory without exhausting all system memory.

The problem is simple I have a process, that does ETL on some xml files. We started getting really large xml files and I started getting OutOfMemoryExceptions. Fixing the process is relatively simple. However, I'd like to make a unit test for my NUnit suite to make sure the process will continue to be able to handle really large files. ...

Easiest way to trigger code at a given time in .NET

I'm looking for something nice and simple. For example: RunAfter(3, delegate() { z = 5; }); // run after 3 seconds FnThatTakes5Seconds(); In my cases I want to test some threading code and have something happen in the middle of another function call. ...

Database Migrations and Views

I am using migrator.net to handle database migrations for SQL Server, and I like it so far. The only issue I've run into is how best to migrate changes to views. Thus far, I've been managing each update as a separate script file (which recreates the view). This lets me go back to previous versions of the view without duplicating the c...

Novell Integrated Authentication - Get local machine username on website

First off, I know how to and has Integrated Windows Authentication in IIS7. This works great for seeing the Active Directory user logged on the computer. But, the need is to get the username of a Novell authenticated user. I don't want the password or anything more than the username. Other restrictions: Can't install anything on the...

MS Project Add-In Programming in .Net

We are building an Add-in for MS project and relatively new to the Office SDK programming. Any tips, guidelines, links for MS Project Add-In programming would be really helpful. ...

Calling a function with an out argument using Invoke

I have an ojbect with a function that takes an out argument. I want to call this function using reflection's Invoke. However, I can't find a way to specify that it's an out argument, as it is returned null. Class Foo { void Do(out string a){ a="fx call"; } } Foo f = new Foo(); string param = string.Empty; f.GetType().GetMethod("Do...

Linq query with Array in where clause?

Hello all, I have searched for this, but still can't seem to get this to work for me. I have an array of Id's associated with a user (their Organization Id). These are placed in an int[] as follows: int[] OrgIds = (from oh in this.Database.OrganizationsHierarchies join o in this.Database.Organizations on oh.Org...

What are some techniques for migrating a large MFC application to WPF/.NET?

I am currently working on a very large legacy MFC MDI application. It has a large number of UI elements - dockable toolbars, custom tree controls, context menus, etc. It is an image processing application so the main views render themselves using DirectX and OpenGL. The product is about 10 years old and one of the priorities here is t...

Sharepoint Workflow: How do I get the "BeforeProperties" in a WorkflowItemChanged event handler

I've got a sharepoint workflow with a state where I'm waiting to see what changes the user makes to the list item the workflow is attached to. My state has a "OnWorkflowItemChanged" activity. On that activity I've bound the "AfterProperties" and "BeforeProperties" which created the following members in the code behind: public Hashta...

Command Line CD (Change Directory) variant in C#?

I want to write a simple C# console application to change the current directory of the command line to a directory the application works out. Looking through MSDN System.IO.Directory.SetCurrentDirectory looks ideal for this until I saw in the remarks that: 'When the application terminates, the working directory is restored to its ...