.net

Daylight saving changes affecting UTC conversion

Basically I'm converting local dates stored in the database into UTC. But I've read somewhere that daylight saving rules have changed in 2007. So does the Date.ToUniversalTime() function still work correctly. Basically the dates before 2007(when the new rules came into effect) would be converted correctly but the dates after that would b...

How to tell if Excel Application is in cell-edit mode?

I'm writing an Excel Addin using COM Interop from .net. I have a command that pops up a dialog, and from the dialog I do some work like collecting data from the used range of several sheets. The problem is that if a cell is in edit mode, some of the calls that I need to make will throw exceptions. I would like a way of determining before...

Guidelines for using the ASP.NET Wizard efficiently

A web app our group has put together uses the ASP.NET Wizard control. Each step in the wizard contains a corresponding custom UserControl. The trouble is that as you go through the wizard steps, all the UserControls are loaded on each step, rather than just the one used in that step. That doesn't seem right to me. So...is there anybo...

Target Framework Mismatch

When adding a reference to a project I sometimes see the message... "The Target Framework version for the project is higher than the current project Target Framework version. Would you like to add this reference to your project anyway?" I understand what the message is indicating but can anyone explain what issues might arise from sayi...

Drag WPF Popup control

hi there, the WPF Popup control is nice, but somewhat limited in my opinion. is there a way to "drag" a popup around when it is opened (like with the DragMove() method of windows)? can this be done without big problems or do i have to write a substitute for the popup class myself? thanks ...

How do I create 7-Zip archives with .NET?

How can I create 7-Zip archives from my C# console application? I need to be able to extract the archives using the regular, widely available 7-Zip program. Here are my results with the examples provided as answers to this question "Shelling out" to 7z.exe - this is the simplest and most effective approach, and I can confirm that it...

Any way to add some default assemblies to resolve types from in Unity / ObjectBuilder?

I'm working on my 1st project using MS Unity IoC framework. If I have this in my unity configuration: <container name="TestBusiness"> <types> <type type="PFServer.DataAccess.TestDataAccess" /> Then I get the error: Could not load type 'PFServer.DataAccess.TestDataAccess' from assembly 'Microsoft.Practices.Unity....

DOTNET SOAP Not Recognizing "ArrayOf_xsd_anyType"

Getting the following error when I try to execute a SOAP request using .net: failed: System.InvalidOperationException : There is an error in XML document (1, 776). ----> System.InvalidOperationException : The specified type was not recognized: name='ArrayOf_xsd_anyType', namespace='http://soap.ddr.opentext.com', at <multiRef xmlns=''>...

.NET COM Interop Method Signature

What interop signature would you use for the following COM method? I am interested particularly in the final two parameters, and whether to try to use MarshalAs with a SizeParamIndex or not. HRESULT GetOutputSetting( DWORD dwOutputNum, LPCWSTR pszName, WMT_ATTR_DATATYPE* pType, BYTE* pValue, WORD* pcbLength ); Doc...

Option Strict On and .NET for VB6 programmers

Hi, I'm preparing a class on Visual Basic 2005 targeting Visual Basic 6 programmers migrating to the .NET platform. I would like a word of advice about whether to recommend them to always enable Option Strict or not. I've worked exclusively with C-style programming languages, mostly Java and C#, so for me explicit casting is something I...

Effective copying multiple files

I have to copy quite a lot of files from one folder to another. Currently I am doing it in this way: string[] files = Directory.GetFiles(rootFolder, "*.xml"); foreach (string file in files) { string otherFile = Path.Combine(otherFolder, Path.GetFileName(file)); File.Copy(file, otherFile); } Is that the most efficient way? Seem...

Filetype association with application (C#)

Hi, I have a few questions related: 1) Is possible to make my program change filetype association but only when is running? Do you see anything wrong with this behavior? 2) The other option that I'm seeing is to let users decide to open with my application or restore default association ... something like: "capture all .lala files" or...

HttpBrowserCapabilities.Crawler property .NET

How does the HttpBrowserCapabilities.Crawler property (http://msdn.microsoft.com/en-us/library/aa332775(VS.71).aspx) work? I need to detect a partner's custom crawler and this property is returning false. Where/How can I add his user agent so that this property will return true? Any other way outside of creating my own user agent de...

Embedding assemblies inside another assembly

If you create a class library that uses things from other assemblies, is it possible to embed those other assemblies inside the class library as some kind of resource? I.e. instead of having MyAssembly.dll, SomeAssembly1.dll and SomeAssembly2.dll sitting on the file system, those other two files get bundled in to MyAssembly.dll and are ...

Can I return a varchar(max) from a stored procedure?

VB.net web system with a SQL Server 2005 backend. I've got a stored procedure that returns a varchar, and we're finally getting values that won't fit in a varchar(8000). I've changed the return parameter to a varchar(max), but how do I tell the OleDbParameter.Size Property to accept any amount of text? As a concrete example, the VB co...

Which web service framework?

I'm about to get started converting a C# based desktop app to be web based. For a couple of reasons, I would like to cut the GUI from the logic via a web service. Microsoft has asmx files, WCF, and probably something new at PDC next week. Data can be passed via SOAP, REST, JSON, and probably 12 other ways as well. Could anyone sugges...

What dotnet collection class's items can be enumerated in "addition order" and retrieved via a key?

I'm lead to believe that I cannot count on the order of items added to a dictionary for enumeration purposes. Is there a class (generic if possible) to which items may be added with a key and which can be enumerated in addition order or which can be retrieved by key? Clarification: I do not want to enumerate in Key Order. I want to enu...

In Silverlight, how to invoke an operation on the Main Dispatch Thread?

In a WinForms UserControl, I would pass data to the main GUI thread by calling this.BeginInvoke() from any of the control's methods. What's the equivalent in a Silverlight UserControl? In other words, how can I take data provided by an arbitrary worker thread and ensure that it gets processed on the main displatch thread? ...

What is the best way to read, represent and render map data?

I am interested in writing a simplistic navigation application as a pet project. After searching around for free map-data I have settled on the US Census Bureau TIGER 2007 Line/Shapefile map data. The data is split up into zip files for individual counties and I've downloaded a single counties map-data for my area. What would be the b...

Time date conversion in linq

I wanted to compare the datetime which is in this format "7/20/2008" with the ones in the database which is in format "7/20/2008 7:14:53 AM". I tried using "like" clause but it did not work beacuse the "like" clause uses only string and the one which I am using is date time format. Can anyone tell how to convert and compare it in datab...