.net

Disable clicking through other controls - WPF

Hello. I have Simple application. <Window x:Class="WpfControlReview.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlfo...

Which objects will go to Stack and which to Heap and why?

Possible Duplicate: How does .net managed memory handle value types inside objects? I have a class as below public class MyClass { public List<RequestRow> RequestRow { get; set; } public List<int> intList { get; set; } public string ErrorMessage { get; set; } public string SuccessMessage { get; set; } int i; D...

SqlCacheDependency leads to lots of queries to my db

I have implemented my own SqlCacheDependency public SqlCacheDependency CacheControllerDependency(CacheControllerKeys cacheKey) { SqlConnection conn = new SqlConnection("connection"); try { SqlCommand command = new SqlCommand( @"SELECT [CacheName] ,[CacheReloadDate] ,[CacheRelo...

wpf databinding to a property of same control

I have a control (let's say a textbox) and I want bind the value of one property (let's say tooltip) to value of another property in same control(let's say text). i want something like belowing but I dont know how can I bind the tooltip to text of same control : <textBox text="abc" tooltip={Binding ???} /> ...

Visual Basic 2010 Console Writing Out

I am working with a console application for VB 10. How can I replace data that I have already written with: Console.Write Or how can I write on a specific point: e.g. 100 lines, 100 chars left In the same way that a program such as wget has a loading bar that does not keep getting replaced every time progress is increased. ...

silverlight v.s. flash for video quality

Hello everyone, I heard Silverlight support high quality definition video, which flash does not support. Is that true? If yes, any other benefits comparing Silverlight to Flash? If anyone could provide some document to make a reference, it will be appreciated! thanks in advance, George ...

Format string with dashes

I have a compressed string value I'm extracting from an import file. I need to format this into a parcel number, which is formatted as follows: ##-##-##-###-###. So therefore, the string "410151000640" should become "41-01-51-000-640". I can do this with the following code: String.Format("{0:##-##-##-###-###}", Convert.ToInt64("41015100...

How do you set a custom theme for a .NET application?

Much as the title says, I am wondering how to style a program like Photoshop CS4 or Autodesk Maya 2011. These programs are styled to where the UI looks completely custom. Right now I am using C# to program, but I can easily switch to C++ and WinAPI if it is easier. I have done multiple google searches for styling controls in C#, but ther...

COM-Interop: Change .NET Framework Version from 2.0 to 4.0 - Should I change the Guids also?

I like to migrate a COM-Class from 2.0 to 4.0. Would you recommend also to generate new guids for the classes and a different ProgId? The old Class would not be used anymore. I know I have to re-register the Class, for the new Path of the mscorlib. MS-Access create an instance auf my COM-Server Class with CreateObject and my COM-Object...

Installing services from a multi-service /net assembly

Hi, I have a dot net windows service project which contains multiple services. This has now reached our deployment engineer who installs all his services using an automated script. The script uses SC.exe to create the services, he doesn’t use intallUtil. Unfortunately, from what I can see, SC.exe only ever creates a registry entry for th...

Problem with loading culture from XML using CultureAndRegionInfoBuilder on Windows XP

Hi, I have a web application that will use a few different cultures, one of which is es-US (Spanish United States). However, Windows XP do not have any support for the culture es-US. To work around the problem, I've found out that one is supposed to be able to use the CultureAndRegionInfoBuilder. So I looked into CultureAndRegionInfoBui...

Extending C# language?

Basically what I would like to know is if there is any way to add new 'statements' to the .net based languages? An example of what I'm looking for would be something like introducing a public class MyClass decoratorOf ClassWithLotsOfMethods and in pre-compile time changing that to be a normal class that overrides everything by default bu...

Hang With ScardConnectA on Win 7 64bit

Hi There, I am updating a smart card application (.net 2 using winscard.dll) to run on Windows 7. Only minor changes are required for 32bit. Under 64bit there appears to be a hang calling SCardConnectA - it sits and does not return. Stopping the smart card service/removing the card allows the application to complete. The .net app uses ...

Operation could destabilize the runtime when emiting a nullable setter

Hello, I am currently overriding the setter of a given class with Reflection.Emit. Everything works fine except when I use it with a nullable property.... Here is the code I use : ilSetterGen.Emit(OpCodes.Ldarg_0); ilSetterGen.Emit(OpCodes.Call, baseGetter); ilSetterGen.Emit(OpCodes.Ldarg_1); ilSetterGen.Emit(OpCodes.Ceq); Label retLa...

How do I know if I'm running in a web environment?

I'm wondering if someone has a method for detecting whether or not a thread is running in a web environment. HttpContext.Current is not reliable because I'm making these checks in background threads where there is no HttpContext. It seems like HttpRuntime.AppDomainAppId is pretty reliable (if it is null then I'm not in a web app), ...

Execute script after deployment - MSDeploy

Is there a way to trigger a custom script (or open a windows app) after a user imports the deployment package using IIS and completes the installation? Any help? ...

WCF Service and Threading

I have created a simple WCF (.NET 3.5) service which defines 10 contracts which are basically calculations on the supplied data. At the moment I expect quite few clients to make a call to some of these contracts. How do I make the service more responsive ? I have a feeling that the service will wait until it process one request to go to ...

Determine which control is closest to the mouse pointer

In my C# (.NET 2) app I'd like to determine which control is closet to the mouse. I can think of a few ways to do this that won't quite work right. I could use the Control.Location property, but that just gives me top/left, and the mouse might be on the other side of the control. I could calculate the center point of a control, but larg...

Multiple contact forms within a .NET page

Tearing my hair out here trying to implement a pretty simple form inside a .NET page. The form looks like this: <form action="http://domain.com/subscribe.tml" method="POST"> <p><input name="email" type="text" /></p> <p><input type="image" src="/images/ui/btn-getfreereport.gif" alt="Signup" /> </p> <input type="hidden" value="one_he...

Look Around does not deliver expected result with .net

I want to use a look-ahead regex for replacement with the System.Text.RegularExpression.Replace(...) method. Now I am wondering what's wrong. Look at this example code: string input = "stackoverflow"; string replacement = "#"; var pattern1 = "(?=[a-z])o"; var result1 = Regex.Replace(input, pattern1, rep...