.net

TypeConverter for generic type used in xaml

I am looking into initializing members of generic types declared in XAML. This is targeting the (reduced) generics support in WPF 4 and future Silverlight. (I have tried the scenarios below using x:TypeArguments and XamlReader.Load in VS2010 Beta 2, but will use TestClassInt32 : TestClass<int> { } for simplicity, as it has the same behav...

Minimize/Restore with hidden caption bar makes windows forms window grow

I hit this problem in Windows Forms, after using PInvoke of SetWindowLongPtr to remove the caption (WS_CAPTION) from a Sizable window. After that whenever the window is either Minimized or Maximized and then restored to Normal it grows (by the CaptionHeight + border). It appears that Windows Forms' layout mechanism is trying to compens...

How to create a popup menu in visual basic.net?

How can I create a popup menu in vb 2008 for use as a context sensitive menu for when I right-click? ...

Pattern to catch exception from sections of code (while not making eyes bleed)

I have a section of code that looks like this: try { classVar = functionCall(input, sEnum.First); classVar = functionCall(input, sEnum.Second); classVar = functionCall(input, sEnum.Third); } catch (Exception ex) { Debug.Assert(false, ex.ToString()); } However my exception dosent show which specific call it came from. The sta...

Error when instantiating .NET/COM interop class via classic ASP

Hi all, I am having a problem when trying to instantiate a C# .NET class that's been exposed to COM in a classic ASP application. I've used tlbexp to generate a typelib and registered it in Component Services; now when trying to create the object as such: Server.CreateObject("The.Class.Name") I am getting the error: Server object er...

Database Change Management using hand generated scripts

My need is fairly basic and I don't want to rebuild the wheel. I like to script my database and have written scripts to update it from one version to the next ie 001-create-tables.sql, 002-alter-column.sql etc. What I want is a simple tool command line or MsBuild that will look at a database see what version the database is at (usin...

Where to put the interfaces in a component based architecture?

In a component based architecture where a large number of decoupled components communicate through a set of standardized interfaces - are there any guidelines for where-to-store / how-to-group the interfaces? Extreme solutions would be: All in the same assembly (and off you go) One assembly for each interface Both of these option se...

Setting the Page-Title in .Net using C# from a Class

Question, How do i set the title of a page from a class. Is it even possible? I can and have set the page title from a page itself and a usercontrol. Can I, How Do I do this via a class using C# .Net Here is what im looking to do, From the Aspx Page i want to call a function that passes in the string title, and have the class set th...

VB6 App Calling .NET DLL OutOfMemory Exception

We have a VB6 app that calls out to a .NET DLL. Occasionally, after the VB6 app has been running for a long time and has called the .NET code a lot, the .NET side of things throws an OutOfMemory exception, even though there is plenty of memory available on the machine. The VB6 memory space is also no where near it's limit. Does the .NE...

Directory.Exists returns true when directory is not present

I am working on an application for Windows 7, and run some routine directory creation code: string dirPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MyDir"); if (!Directory.Exists(dirPath)) Directory.CreateDirectory(dirPath); The problem is that the Directory.Exists line returns...

Can I use Fit/Fitnesse to test a .NET application?

Has anyone tried that? What's your experience? ...

Why is the content being corrupted when writing to response stream

I'm trying to write out to the response stream - but it is failing, it is corrupting the data somehow... I want to be able to write a stream stored somewhere else to the HttpWebResponse so I can't use 'WriteFile' for this, plus I want to do this for several MIME types but it fails for all of them - mp3, pdf etc... public void ProcessR...

How do I get specific versions of the .NET runtime for use in windbg?

I am debugging an old process dump from one of our servers. It was created about a month ago. To work with SOS, I need version 2.0.50727.4016 of mscorwks.dll and mscordacwks.dll for the AMD64 architecture. Is there some official place to get these dlls? I found one question on StackOverflow that somewhat addresses the issue, but the sol...

Determining system requirements (hardware, processor & memory) for a batch based software application

Hi, I am tasked with building an application wherein the business users will be defining a number of rules for data manipulation & processing (e.g. taking one numerical value and splitting it equally amongst a number of records selected on the basis of the condition specified in the rule). On a monthly basis, a batch application has ...

how do I send custom headers from flex to a web service in c#?

I've searched the web but i'm not getting it This is my flex code: private function callWS():void{ var ws:WebService = new WebService(); //changed this ws.addHeader(new SOAPHeader(new QName("uri","header1"),{AUTH:"bla"})); ws.loadWSDL("http://localhost:49548/test/WebService1.asmx?WSDL"); ws.HelloWorld.addEventList...

Problems with Linq using anonymous type

Why did the anonymous type property "Points" still have the value "0"? Public Class Test Public Sub New(ByVal _ID As Integer) ID = _ID End Sub Public ID As Integer End Class Dim list As New List(Of Test) list.Add(New Test(1)) list.Add(New Test(2)) list.Add(New Test(3)) Dim query = From X In list Select New With {....

Visual Studio Compilation Time Statistic

Anyone know an add-in or something that could give me the number of time spent on compiling during the day? I am interested to gather some data about the time I use Visual Studio to code and to compile. Any tips would be welcome too if no add-in exist. Edit: I would need to have in the time all DLL loaded too by the ASP.Net webserver, ...

How to dispose of a NET COM interop object on Release()

I have a COM object written in managed code (C++/CLI). I am using that object in standard C++. How do I force my COM object's destructor to be called immediately when the COM object is released? If that's not possible, call I have Release() call a MyDispose() method on my COM object? My code to declare the object (C++/CLI): [Gui...

How to merge multiple ControlCollections in C#?

Is there an elegant way of doing this? Perhaps with Linq? For something like this: List<ControlCollection> list = { ... } List<Control> merged = list.MergeAll(); EDIT: The final collection will be single dimensional in a sense that all controls will be there, not in a nested way. ...

Why is ToLookup() dependent on load options in Linq2Sql?

Lets say I have 3 tables Posts, PostTags and Tags defining a many-to-many relationship. I want to get a lookup table that will give me all the Posts related to a given tag so I use the following code: return dataContext.PostTags.ToLookup(pt => pt.Tag, pt => pt.Post); In unit test all went fine but in the real application, it didn't wo...