.net

Load a COM dll at runtime?

I'm writing an application for the Peachtree API and it needs to work with any version of the API. Unfortunately the dll from Peachtree 2011 can't interact with Peachtree 2010, and vice versa, even though the two dlls are stored in the same location and run with exactly the same code. I thought I should be able to refer to the dll by i...

.NET XML Serialization Array/List object alias

Hi, I need to serialize an object like this: public class Book { public string Title { get; set; } public string[] Authors { get; set; } } This generates something like this: <?xml version="1.0" encoding="utf-8"?> <Book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema...

Silverlight error 4004 value does not fall within the expected range.

hi all, I get the following error when I try to edit and save fields in dataform : Microsoft JScript runtime error: Unhandled Error in Silverlight Application Code: 4004 Category: ManagedRuntimeError Message: System.ArgumentException: Value does not fall within the expected range. at MS.Internal.XcpImports.MethodEx(Int...

What is the best way of representing an immutable list in .NET?

I've recently started using F# for "real work" and rediscovered the beauty of immutable data structures such as the discriminated unions and records in F#. I've also found them to be quite straight forward to use from C#, especially as they don't require any direct dependencies on the F# runtime. However, when it comes to representing li...

Can a programming language be part of a platform? (C# and Java related)

Hi all. He's the deal: I'm making some theorical research on .NET and Java platforms for my graduation course and I reached a cloudy area: Can C# be considered part of the .NET Framework? Analog to this, is Java (the programming language) considered part of the Java platform? Let me review the facts: .NET is a development platform ...

Windows 7 x64 .Net App Crash (works on everything else)

I'm working on a .net application compiled for "Any CPU". We have succesfully deployed the application to mutliple environments. The only one giving us issue is Windows 7 x64 (it is crashing immediately complaining for BadImageFormatException). When I run the application with Process Monitor attached, I get the following before it ini...

Is it possible to expose events of a member object of a class to the outside in .NET?

Say I have a User Control in ASP.NET that contains a button: public class MyUserControl : UserControl { private Button btnSave = new Button(); } I can expose any property of the button to the outside by making a property that points at the button: public string SaveButtonText { get { return btnSave.Text; } set { btnSave...

How to specify user credentials for a click-once application?

For a regular .exe file i can always right click and select "run as..". How can i run a Click-Once application under different credentials in a similar way? I am talking about the application itself, not the installer. ...

Installing C# Windows Service on Windows 7

I have a batch file that I have been using to install my C# Windows Services for awhile now, never had a problem until Windows 7. I have attempted to run the batch file with Administrator privileges. I have attempted to run the command prompt with admin privs, navigate to the windows service EXE and run InstallUtil there. Still doesn't w...

how to use the datareader across multiple functions in a single .net web page.

Is it better to declare the datareader as public or declare as local to each and every function in which we use the datareader in a .net page? ...

filter pornography in a video/picture c# library

C# - How do filter pornography in a video/picture - Is there library I can use commerical or open source is OK. I am totally lost - thanks ...

Can I distribute Windows Support Tools with my package?

I'm using httpcfg.exe tool from my program. So for the computers that don't have httpcfg in them, can I distribute this tool packaged with my program? Or if I could include Windows Support Tools msi, that would work too, although that would unnecessarily increase the size of my installer. If you're thinking I should've just read the lice...

how to host a custom control in custom cell in DataGridView?

I have a custom control that I had created I need to host it in the cell of DataGridView. ...

help with Could not load file or assembly error

I have about 70+ sites that all run off the same code base. Last week I tried to make sign all of the dlls so I could move them to the GAC so all the sites would use those instead of each having their own bin folder. I've run into a hiccup with that idea and I have to wait until we get some other issues sorted out on the test server ...

Displaying ObservableCollection in a side-by-side format

In a WPF application, I am attempting to display the elements from an ObservableCollection in a side-by-side fashion. For example, if the collection was of letters, the basic format would be: Letters A D G J B E H K C F I L etc.. I am considering making each a separate ListView and then breaking each ViewMo...

WPF TextBox Databinding woes >:-(

What should be one of the most simpliest form of databinding, is now causing me great amounts of grief. In my XAML, I have something as such: <TextBox Text="{Binding Path=Speed}" /> Then in my matching .cs file, I have a property as such: public int Speed { get; set; } But they aren't binding in harmony and I don't understand why...

.NET events to C++ COM client

Adam Nathan in his book ".NET and COM" demonstrates how to hook up events from a C# library to a COM client, but the client code is shown only with a VB sample--I need C++. The C# client implements the Phone class: [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface IPhoneEvents { [Dispid(1)] void Ring(); } publi...

c# generic method + reflection question

In C# I want to create a generic method that: Accepts a MethodInfo object as a parameter. Returns the object that is returned when the MethodInfo is invoked. The source of my confusion is that I want the method to be generically typed to the same return type as the MethodInfo object that gets passed in. ...

ASP.NET MVC HTML helper methods for new HTML5 input types

HTML5 appears to support a new range of input fields for things such as: Numbers Email addresses Colors URLs Numeric range (via a slider) Dates Search boxes Has anyone implemented HtmlHelper extension methods for ASP.NET MVC that generates these yet? It's possible to do this using an overload that accepts htmlAttributes, such as: H...

Access WPF (XAML) Element from F# ?

Let's say I have this xaml code : <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <Canvas> <Rectangle Name="papan" Fill="Red" Height="20" Width="20" /> </Canvas> </Window> And I have a file named Program.fs (F# code), how can I ac...