.net

Enable "Current Page" in PrintDialog

Im using a System.Windows.Controls.PrintDialog to let the user print one or more pages from my application. This is what I currently got: PrintDialog printDialog = new PrintDialog(); printDialog.PageRangeSelection = PageRangeSelection.AllPages; printDialog.UserPageRangeEnabled = true; if (printDialog.Sh...

Check IIS Application pool if its empty (C# / IIS6)

Hi, We're building an installation tool which can install applications by a configuration file. There is a lot of IIS involved and we mostly use WMI for the job. Recently we discovered that 2 of the applications use the same website and application pool. I can check the website to see if it contains any VDirs and delete it (while uninst...

Getting the current ProcessID in .NET

What's the simplest way to obtain the current process ID from within your own application, using the .NET Framework? ...

RuntimeTypeHandle.Allocate

Hi, I have coverted project to .Net 4.0 and folowing code doesn't work: typeof(RuntimeTypeHandle).GetMethod("Allocate", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(type.TypeHandle, null) It seems that there is no more Allocate method in RuntimeTypeHandle class. GetMethod returns null. What is the analog in .Net 4.0? ...

Visual Studio add-in for performance benchmarking

I'd like to measure the performance of some code blocks in my c# winforms application. In particular I want to measure performance regression/improvement after some restructuring of the code. So long I've seen the System.Diagnostics.Stopwatch. However, I want to avoid writing measuring code into my classes, I would rather prefer to sepa...

Regular Expression: Match untill pattern is found

Hi, I want to extract the status from the string untill I found a timespan. My input is something like "Something in start but not with this keyword of sure. STATUS: My Status Is Here Which can be anything but timespan 23:59:01 and so on. I want to extract the string after STATUS: untill 23:59:01 is found. How can i achieve this through ...

Is timer good solution for this?

Hi! I have application that use MSSQL database. Application have module that is using for sending messages between application users. When one user send message to another i insert message in database, and set message status to 1( after user read message database I update and set message status to 0). Now,i am using system.timers.timer...

Set ContentTemplate in CodeBehind: XamlParseException 2260 Error

Hi, I'd like to change the ContentTemplate of a ContentPresenter in the CodeBehind file. But if I run the Silverlight 4 application a XamlParseException with the error code 2260 occures. foreach (ContentPresenter item in Headers) { item.ContentTemplate = Parent.UnselectedHeaderTemplate; } if ((index >= 0) && (index < Headers.Count...

can you help me with 8086 project for Delphi .net please

To find an Assembly programmer is very hard to help me I'm a established Delphi programmer that has an old copy of Delphi that is not .net And I have a *.dll that I'm converting into Delphi code for .net I'm on a big learning curve hear as i know little of .net yet. I've just got a computer with .net today!!!!!! I've run the *.dll thro...

Unable to change URL for .NET reference to dynamic web service

Hi all, I have a web reference added to a C# .NET project. The URL for the web reference needs to change depending on whether I'm building for a development, staging or production environment. I've set the web service to be dynamic, which supposedly means it takes the URL from my app.config file. When I perform a build it overwrites ...

Iterating through items of CompositeCollection

Consider the code: ObservableCollection<string> cities = new ObservableCollection<string>(); ObservableCollection<string> states = new ObservableCollection<string>(); ListBox list; cities.Add("Frederick"); cities.Add("Germantown"); cities.Add("Arlington"); cities.Add("Burbank"); cities.Add("Newton"); cities.Add("Watertown"); cities.Ad...

Databinding to object - howto update object/binding?

I got a textbox and use databinding to an object. This works fine, until I try to select a new product: product = new Product(id); textbox.DataBindings.Add("Text", product, "ProductName"); // After user action: product = new Product(newId); // <- the textbox isn't updated Do I have to clear the databinding and set it again after the ...

How to maintain my data like a session variable in .NET WinForms?

I am using .net Windows Forms i need to maintain some date to check the condition. so i have to maintain it up to user logged out? like session in ASP.NET how can i do this? (note it should not expires until the user logged out) ...

Recieve Events from the BOs

How to keep receiving events even with changed references? In a project I have the following relation between BO and GUI By e.g. G could represent a graphic with time lines, C a TimeLine curve, P - points of that curve and T the time that represents each point. Each GUI object is associated with the BO corresponding object. When T ch...

Join two contracts into the same WSDL

Hello, Maybe it is science fiction, but i would like to know if it is possible to join a WF exposed with WCF and a WCF into the same WSDL. As you know a WF service (xaml) exposes a wsdl and a WCF (svc) exposes its own. The background problem is that I do not want to differenciate long running process and short synchronous ones into dif...

Using a 3rd party activeX on a User Control hosted in on a web (.aspx) page

I want to wrap a 3rd party activex on a user control with other controls (buttons & labels) and want this user control to be hosted on a web page. For this purpose, I've created a user control. Created a winform and a webform application and added the user control to both of them. After placing the 3rd party activeX on User Control, wh...

2 basic but interesting questions about .NET

Hi, when I first saw C#, I thought this must be some joke. I was starting with programming in C. But in C# you could just drag and drop objects, and just write event code to them. It was so simple. Now, I still like C the most, becouse I am very attracted to the basic low level operations, and C is just next level of assembler, with few...

Custom Installer needs to detect .NET Framework

Hi, I am writing a custom installer in C#. Can you tell me an easy way to check if the machine has .NET version installed [even 2.0]. In cases where it is not installed, my app doesn't even start. Thanks ...

How to create minidump of a .NET process when a certain first chance exception occurs.

Dear ladies and sirs. My application throws InvalidCastException in the QA environment, something I cannot reproduce in development. I wish to obtain the minidump at the exception moment. I know about adplus, but I am not sure how to use it so that it creates the minidump when InvalidCastException is thrown. Apparently, it does not dis...

Implementing google dashboard type interface in asp.net

I'm looking at implementing a Google IG type dashboard in a .net app. There are a number of options I've found to do this, and i'm trying to establish what is going to be the best to use, in terms of speed, versatility etc. So far the options I am looking at are either to use asp.net webparts and .net Ajax, this would make it quicker t...