.net

How to force AutoCompleteBox control to populate the ItemSource only after n chars are entered?

Is it possible to force AutoCompleteBox control in SilverLight application to start obtaining ItemSource data only after n chars are entered (the data with the filtering mode StartsWith? Thanks, Here is the way I bind my ItemsSources (Basically there is a comboBox which stands for Stetes. And once a state is selected I set itemsSource...

Why does this code not bind SelectedItem to a property?

Hi, I'm pretty new to XAML, and my first task in a new job is to untangle a particularly malodorous collection of spaghetti code. Learning XAML at the same time as untangling this horror-show is proving somewhat beyond me, so my apologies for the homework-level questions I'm asking, these days. Anyway, I have the following XAML code: ...

Most useful .NET utility classes

Hi, This post is for all .NET developers who often tries to reinvent the utility classes which already does by many programmers around the world. I request everyone to please post your favourite utility classes(with code) here. To start the show, Given below is the c# code for multithreaded singleton. Multithreaded Singleton using...

Virtual machine vs physical machines for QA/UAT? .Net Runtime bug on VM Slices

My IT department is pushing me to use VM slices for out QA and UAT testing. I believe we should be using identical physical hardware to Prod. Our prod setup uses 5 high-spec servers. For QA there would be 5 vm slices on a single high-spec machine. Apart from the performance difference I’ve also experienced .Net Runtime crashes on VM sl...

Sitecore Access rights for a custom role not behaving as i expected

I am having trouble with setting the secutrity rights for the Media Library of one of our customers. For the "Sitecore Client Authoring" role I have specifed that it has only read access for the entire Media Library. I needed to "unprotect" items to do this but the Access Viewer tells I have succeeded. Subsequently I wanted to specify ac...

Class-level validation

Hello! I am validating a class with DataAnnotations utils. I have a class that has a Title property and an Item property. I want to apply a RequiredAttribute to the Title property but it should be invalid only if the Item property is null; if the Item property is set with an object, the Title is not required. In short words, I want th...

Faulting application <app_name>, version <version number>,faulting module kernel32.dll

Hi, I have one windows application built using C# and .net framework 2.0 and its installed on Windows Server 2003. I have tested application on my machine and it works perfectly on my machine. Only difference between two machines is that, my machine has Windows Vista OS and machine on which error occured has Windows Server 2003 OS. W...

Convert DateTime

This works: testDateTime = DateTime.ParseExact("16/10/2010", "dd/MM/yyyy", null); This does NOT: string somedate = "16/10/2010"; testDateTime = DateTime.ParseExact(somedate, "dd/MM/yyyy", null); why?? ...

I am getting a "duplicate association path" error in the NHibernate Criteria when accessing the same table twice.

I have a CreateCriteria that adds a join to the same table twice with different aliases: aCriteria.CreateCriteria("Color", "co").Add(Expression.In("co.ColorId", bikush.Color.Select(x => x.ColorId).ToList())); aCriteria.CreateCriteria("Color","fco").Add(Expression.In("fco.ColorId",bikush.FCColor.Select(x => x.ColorId).ToList())); I'm...

Windows Forms Control for visualizing job steps

I am looking for a (free) windows forms control for visualizing jobs step / phases. Background: In my programm tasks with more job steps are processed. The user should see, what the actual step (of the current taks( is actually processed (at best animated)... ...

Want to find the control over which mouse is placed in wpf

i have a main control in wpf. and many controls placed in main control. when mouse moves over main control i want to find over which control in main control mouse is placed. ...

How to tell apart different exception types in BackgroundWorker.RunWorkerCompleted event handler

I am doing little hobby project in C#, a language I do not know well, and have stumbled upon the following: Suppose you have an asynchronous operation implemented by using BackgroundWorker. Now if there is an exception, event RunWorkerCompleted will be raised and RunWorkerCompletedEventArgs.Error will be non-null. Is the following the ...

I need to create 2D array in C#

Hi I need to create 2D jagged array. Think of a matrix. The number of rows is known, the number of columns is not known. For example I need to create array of 10 elements, where type of each element string[]. Why do I need that? The number of columns is not known - this function must simply do the allocation and pass array to some other...

How can write a C function in a C# code.

I want to add a C file into my .NET application. How can I built this? How can i write unmanaged code in C#. Can someone explain with few lines code. Thanks ...

Set-based execution; SQL and .NET

In SQL, one should always strive for set-based operations versus iteration-based (i.e. looping). In .NET, we frequently loop collections and objects. Are there any commands in .NET that allow set-based processing or is everything iteration-based? (I'm reminded of how DataAdapter.Fill calls DataReader which iterates through each record in...

Syntax highlighting in .net richtextbox, how do I deal with newlines?

I am trying to highlight some syntax in a richtextcontrol (quoted text, XML tags, XML comments). Apart from the obvious problem created by my own stupidity (for example, a run through the text to highlight the syntax takes over a second and I certainly cannot check the syntax whenever a character was typed) I also ran into an issue cause...

Read source code from tabs in IE/Chrome/Firefox

Using C# and any .NET version I'd like to create a program that can read the source code from any open tab using IE, Firefox or Chrome. This is a program that I use for just myself. I haven't been able to find any useful information by Googling this subject. Thanks! ...

Type comparison not returning expected result.

I am using the following code to compare types so that a DataContractSerializer will re-initialize with the correct type if necessary. private void InitializeSerializer(Type type) { if (this.serializer == null) { this.serializer = new DataContractSerializer(type); this.typeToSerialize = ty...

Trouble updating self-tracking entities

Hi I'm using self-tracking entities in a WCF client-server application. My WCF service returns various entities, and these can be updated using corresponding Update methods. This worked well for a while, but now I'm having problems. To keep the focus, I'l limit this discussion to a specific case, simplified to the bare essentials. One...

x509 and digital signature

I'm rewriting an application so that we can stop using the old Microsoft.Web.Services2.Security.X509 from Microsoft.Web.Services2.dll and start using System.Security.Cryptography.X509Certificates. There is one method that I can't figure out, though: bool Microsoft.Web.Services2.Security.X509.X509Certificate.SupportsDigitalSignature() ...