Posts

Showing posts from May, 2013

C# .NET Winforms Form CancelButton not working

I've recently had a problem that the "CancelButton" property on a WinForm wasn't working. When it should cause the form to close when you press the Escape (ESC) key, nothing was actually happening. I put this down to the fact that I'd been on a very long bike ride the day before and was rather tired but it's because I'd named the button "CancelButton" which is of course the same as the property on the form causing a circular reference. I thought I'd post this rather simple fix because it's so stupidly simple someone may overlook the solution on a day they're tired too.

Hyper-V WMI values incorrect for the ResourceType property of Msvm_ResourceAllocationSettingData

Image
When enumerating Hyper-V resources using WMI with the Msvm_ResourceAllocationSettingData class I couldn't find any physical disks by using the appropriate resource type. I however find the physical and synthetic disks listed with a resource type of 17. The documentation for both Msvm_ResourceAllocationSettingData and Msvm_ResourceAllocationSettingData  (v2) reports that ResourceType 17 is actually a serial port. Running the same query against both the V1 and V2 namespaces on the same server reports differing results. This would suggest that either there is a bug in the code or the enum values have changes or the documentation is incorrect. If anyone else has noticed this issue please let me know. I've commented on the MSDN page.