.net

How to specify the exact location of an assembly in a config file

I've got a web application and a corresponding web.config. The application depends upon assemblies, which are located on the system in a specific path (e.g. c:\programms\myprog\bla.dll) but not registered in the GAC. How can I tell my web application where to find these assemblies it depends upon? I guess I can do that somewhere in the w...

Web service cast exception why?!

Error Cannot implicitly convert type 'string[]' to 'System.Collections.Generic.List<string>' The above error is caused when I call a method to a web service List<string> bob = myService.GetAllList(); Where: GetAllList = [WebMethod] public List<string> GetAllList() { List<string> list .... r...

winmm.dll cannot be add as reference

Im using VS2005 and im making a project in vb.net, I was trying to add winmm.dll file but i got this error. "A reference to 'C:\Documents and Settings\rhyatco\My Documents\winmm.dll' could not be added. This is not a valid assembly or COM component. Only assemlies with extension 'dll' and COM components can be refenced. Please make sure...

how to find if an arraylist is single dimensional or multi dimensional in C#.!?

hi, In C#, i have created ArrayList using structures. so it creates multi dimensional array list. public struct ParameterValues { public ArrayList al; }; ArrayList alCombined = new ArrayList(); for(int i=0; i < CONDITION , i++) alCombined.Add(obj.pValue.al); The dimension of ArrayList alCombined depends on the CONDIT...

How to unit test a refresh functionality with stub objects.

I'm working on a unit test which executes some business logic that will eventually result in a refresh (so execute the same query again) of the data. Using Dependency Injection (with Castle-Windsor) the unit tests use stub objects, so a static list of entities is returned from the method that gets the data. So how can I test whether th...

Questions about Excel worksheet embedding in WinForms application

I embed Excel worksheet in a WinForms C# application in two ways - using WebBrowser control and using dsoFramer control. In both cases i'm facing the following two problems: 1. How do i make my embedded spreadsheet read-only? The only way i discovered is by protecting the underlying Excel file, but it causes annoying message boxes to pop...

Windows Mobile API calls - success but GetLastWin32Error returns error code - should I be worried?

I am a newbie to PInvoke calls. I have googled this as it seems like a simple enough question but no joy. I am making muliple Windows Mobile API calls in a row (to detect if my app is already running and then re-activate it). Everything works fine and dandy but I wanted to put in logging etc for the times when it doesn't work OK. Whi...

SignedXml.CheckSignature works in .NET 1.1, but fails in .NET 3.5

Hi folks, I have the following SignedXml code. This code works just perfectly in .NET 1.1, but when i run this in .NET 3.5, the method signedXml.CheckSignature() keeps returning false. With regard to the SignedXml class, did something change between 1.1 and 3.5? I'm puzzeled here! Can you guys help me out here? Thanks! Ben Sig...

.net code generation solutions: how can I write less code?

What solutions are there to avoid writing repetitive code? For example code generators, etc. More specifically for translating objects between the several tiers of my application (from one service to another, from the service to the client (ObservableCollections etc)). Of course more generic solutions are also welcome. ...

Is there a framework attribute to hide a member from reflection in .Net?

Is there an attribute that hides a member (specifically a property) from typeof(MyType).GetProperties() in .net? I'm looking for a quick fix - i.e. not creating custom attributes etc.. thanks ...

HTTP Progress in .Net Compact Framework

I'm working on an application that makes a lot of HTTP "Web Services" requests, some of which can be rather large XML files. Right now the HTTP request is made on a second thread, so the GUI/Form is not locked up. But it is still unable to give the user feedback as to the progress of the request. I've been using the HTTPWebRequest clas...

Updating multiple selected INofityPropertyChange objects in DataGridView

Hi all I'm working with a DataGridView (Windows Forms) with MultiSelect enabled which is placed in a User Control. I'd like to update all selected rows from outside the User Control by calling a public method that implements the following code: foreach(DataGridViewRow dr in dataGridView.SelectedRows) { MyBusiness business = (MyBusi...

Testing of socket communication program

Am starting with socket programming with a simple UDPClient program to send some data. The large code snippet is below: using System; using System.Text; using System.Net; using System.Net.Sockets; using System.Threading; class ShowIP { public static void Main(string[] args) { string name = Dns.GetHostName(); //n...

How can I change the color of the gridlines of a Grid in WPF?

I have a Grid (not a DataGrid, but a real Grid), with GridLines set to True. How can I change the color of the gridlines? Hardcoded in XAML is ok, since it is just for development-reasons. <Grid ShowGridLines="True" /> ...

Learning to build real-world .NET apps by example

I've been doing mainly SQL and front-end HTML/CSS stuff for the past 4 years. I've done a quite a bit of (procedural) coding in a BASIC-like language, too. I do not have formal CS training (I have an econ degree). Now I'm switching gears to OOP in C# .NET full-time. In order to ramp up, I've been reading about fundamental CS topics (...

The most efficient way to parse Xml

The .Net framework now has (at least) four different methods of reading an Xml string. I've used each of XmlDocument, XmlReader, XPath and XElement, but which is the most efficient to use when coding or during execution? Is each designed for a different task, what are the pros and cons? Update: Using a XmlReader appears to be the quic...

PowerShell: Performance of .NET methods calls

Is it possible to call a .NET method from PowerShell with early binding? I have a pipeline script which calls a single .NET method in process {...}. PowerShell calls this method via reflection, and right now Invoke (not the method itself, just reflection call) takes 70% of total execution time. The method is always the same, so I would...

C# Work out min and hours

I have a minute value and i want to have to 2 string values one with how many hours and the other with the minutes. e.g. Value - 121 minutes string hours = 2 string minutes = 1 Value - 58 minutes string hours = 0 string minutes = 58 How can I work this out in C#? ...

Can iBATIS.NET work with ICollection?

Hi, This question is in relation to another question I have: http://stackoverflow.com/questions/603808/using-ibatis-net-with-generic-custom-collection-interfaces-and-unity The problem seems to be that iBATIS.NET will only populate a custom collection (i.e. QueryForObject("Select_Foo") which has a custom collection of Bars) if it is a c...

What's the best way to go about form validation in WPF (with databinding)?

I have several forms with many textboxes/comboboxes, and I would like to have the "Save" button disabled while at least one of the fields are invalid. I've been able to setup some custom ValidationRules, like so (textbox example shown): <Binding Path="Name"> <Binding.ValidationRules> <my:TextFieldNotEmpty/> </Binding.Val...