.net-3.5

Child form looses focus on first click to parent form. How to fix this?

Im writing a new plugin based app. This loads assemblies in their own app domains and displays the specified main forms within each via Application.Run(pluginForm). I set the main form in the loader app as the parent of each pluginForm before calling Application.Run(pluginForm) inside the app domain. Hence when the pluginForm shows it al...

Where do we use Boxing or what's the use of boxing?

By Definition we know that Boxing – Converts value-type TO reference type. Stored on heap. UnBoxing – Converts reference type TO value-type. Stored on stack. But why should I convert a value type to reference type or push my variable from stack to heap or from heap to stack. What are advantages or disadvantages of doing this. wha...

Does boolean.ToString() behave differently between .NET 2.0 & .NET 3.5

I've inherited a piece of code at work and I've just noticed a fairly trivial but bizarre little quirk with it. So maybe someone can save me setting up clean .NET 2.0 Environment to test it out. There is a SQL2K5 table containing a column called IsEnabled BIT NOT NULL There is a sproc selecting from that table There is a piece of C# c...

Storing a list of methods in C#

I have a list of method that I would like to call in a specific order. Therefore I would want to store them either in an ordered list or in a table with a specified index. This way the list would be the only thing to change the day we want to change the call order. I found this article explaining how to do it using an array and delegate...

Open clicked HyperlinkButton in a new window

Based on the below snippet from a silverlight control how do I make the clicked HyperlinkButton open in a new browser window? <HyperlinkButton Content="{Binding Name}" NavigateUri="{Binding Url}" /> I'm assuming that I can do this in the xaml, but I don't see a likely looking property. Thanks, Phil ...

Bin DLL's target different .NET frameworks possible?

I have a website that is currently running under .NET 3.5. I am thinking of making it run under 4.0, but I use many 3rd-party DLL's for compressing, Bit.ly, Twitter, XML, etc. If these DLL's were created for .NET 3.5 (in VS2008), will they continue to run under 3.5? Or is 4.0 somehow backwards compatible for old libraries? ...

ReportViewer 9 in .NET 4 application possible?

I am using ReportViewer 9 in WPF to talk to a remote SSRS server (because I have a SQL Server 2005 Reporting Services requirement) to add reports to a WPF .NET 4.0 application. I can create a project and run ReportViewer 9 using .NET 3.5, but I cannot (either from not being possible, or my lack or knowledge) get it to run within the WP...

The database file corrupted on Windows CE 6.0

I have a .Net 3.5 mobile project which i try to run on a casio DTX-30 machine. But when my CacheCollections function is running, the database file is corrupted. My function contains these codes: Friend Sub CacheCollections() If Not cachedCollections Then CustomerRevenueTypeFacade.FillAllItems(CustomerRevenueTypeCollection) ...

Silverlight (like) Validation in Windows Form app

I need to Enable/Disable my SAVE button in real time based on data in my fields. Is the below an acceptable way on accomplishing this? It feels wrong but I don't know how else I could accomplish this. Each User Control(CRUD Form) has a BackgroundWorker and the following related methods; StartBGWorker() StopBGWorker() RequiredFields...

Web.config file and web code folder

My web.config file is on the root of the application space. My source code must be in another folder off the root. I also have namespaces defined in the web.config. When I run the application it cannot find any of the namespaces that were defined, which is then causing all my @Register tag to crash. How can I have the web.config in one...

Improving speed of Windows Workflow

I have the following code which lets me execute a workflow. This could be called repeatedly. And often is. It's also living in a webservice, so there could be multiple calls to it at the same time. This currently works. But it's slow, since instantiating a WorkflowRuntime each time is very slow. How can I improve this? public clas...

Re-establishing WPF databinding after changing property value

I'm playing with ICollectionView right now, and am encountering a problem where I think I understand the "why", but not the "how do I fix it". :) I have a ComboBox that's databound to an ICollectionView, and it is initially set with the following code: NameView = CollectionViewSource.GetDefaultView( names); // names is an IEnumerable<...

Multitasking checking proxies

I wrote that little program: string sciezka = "http://proxyjudge.hell-spy.de/"; foreach(var ip in listBox1.Items) { ////////////////// CHANGES IP:PORT TO WEBPROXY HOST,PORT string host=null; string zmiana=null; string sport = null; int port=0; int p...

C# Regex.Matches returns too many matches?

Hello Can someone explain to me why the result from the following statement has a count of two an not just one? MatchCollection matches = new Regex( ".*" ).Matches( "foo" ) ; Assert.AreEqual( 1, matches.Count ) ; // will fail! new Regex( ".+" ).Matches( "foo" ) ; // returns one match (as expected) new Regex( ".*" ).Matches( "" ) ; // ...

Linq-to-SQL or Linq-to-Entities with ASP.NET 3.5 and SQL Server 2005

I am starting a new project using C# and ASP.NET 3.5 with SQL Server 2005, and I am trying to decide which ORM is the best to use between LinqToSQL, LinqToEntities, or NHibernate. Ideally I would like to use the preferred Microsoft best practice; but I need to use a solution that will provide performance comparable to using stored proce...

Why doesn't the SourceUpdated event trigger for my Image Control in WPF?

I have an image control on a Window in my WPF project XAML: <Image Source="{Binding NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True}" Binding.SourceUpdated="bgMovie_SourceUpdated" Binding.TargetUpdated="bgMovie_TargetUpdated" /> In code I am changing the source of the image C#: myImage = new BitmapImage(); myImage.B...

Extension "WhenNull" to check for null and init the underlying object via lambda

Hi, I was asked whats wrong/how can the following scenario can be fixed Customer customer = null; customer.WhenNull(c => new Customer()) .Foo(); // instead of Customer customer = null; if (customer == null) { customer = new Customer(); } customer.Foo(); One developer sends me his Version of the WhenNull extension public ...

.NET 3.5: anonymous delegate for handlers with ref params

I have public delegate void DocumentCompleteEventHandler(object pDisp, ref object URL) Can i use lambda expression such as : ie.DocumentComplete += (o, e) => { }; It expression doesn't work. How should i change it for using in code? Is it possible? ...

Dictionary(string -> tuple) in .NET 3.5 ?

I was wondering if there's a way to create a dictionary using an anonymous type for its values. Something like { { "first", {1, true} }, { "second", {2, false} }, } I want to use this in .NET 3.5, so there's no vanilla implementation of Tuple<...> available. Any suggestions? ...

References for what the lifecycle is for a WCF service?

Say I have a simple WCF application that the client calls in order to get a number. There's not much processing in it and the service contract is attributed as SessionMode=SessionMode.NotAllowed. When is the constructor called? When is the object destructed? Is a constructor called per request? Are there any reference documents or reso...