.net

Running animation in background worker

Hi, I m developing an application in vb 2008, and using background worker to copy file(s). I have my own designed form which plays an animationon on the top of the form along with copy. For playing animation i m using "AxMSComCtl2.AxAnimation", on execution i get "ActiveX control '' cannot be instantiated because the current thread is ...

Dispatcher BeginInvoke Syntax

I have been trying to follow some WCF Data Services examples and have the following code: private void OnSaveCompleted(IAsyncResult result) { Dispatcher.BeginInvoke(() => { context.EndSaveChanges(result); }); } Which is called by the following: this.context.BeginSaveChanges(SaveChangesOptio...

How to serialize object into UTF-8

Hi, I'm trying to insert into XML column (SQL SERVER 2008 R2), but the server's complaining: System.Data.SqlClient.SqlException (0x80131904): XML parsing: line 1, character 39, unable to switch the encoding I found out that the XML column has to be UTF-16 in order for the insert to succeed. The code I'm using is: XmlSerializer se...

Is there a LINQ equivalent method?

Folks, I know LINQ has a SequenceEquals method. This method makes sure each item value in each collection matches, in the same order. What I'm looking for is a more "Equivalent" type of functionality. Just that both sequences contain the same items, not necessarily in the same order. For example, nUnit has CollectionAssert.AreEqual(...

Why doesn't [NonSerialized] work on autoimplemented properties?

[Serializable] class MyClass { [NonSerialized] int Foo { get; set; } // error [NonSerialized] int bar; // ok } Why is this disallowed? I know about the workarounds such as implementing ISerializable switching to XmlSerializer/XmlIgnore switching to a manually-implemented property The question is specifically why is [NonSer...

Setting InnerXml for XmlDocument causes missing End-Tag

XmlDocument doc = new XmlDocument(); doc.AppendChild(doc.CreateElement("Foo")); doc.DocumentElement.InnerXml = "Test"; StringBuilder result = new StringBuilder(); doc.WriteContentTo(XmlWriter.Create(result)); At the end, result is: <Foo>Test that means the end element is missing. Why is ...

Removing incomplete P Tags (using REGEX or any other method)

hi, my problems is a bit case specific , first of all, Its only for <p>tags not for any other tag.So you need not worry about any other tag. I am having html document which is a output of one software ,but it has some errors like unclosed <p> tags. eg. I have taken all document in a string my document is like .. <html> .....

Listing all referenced assemblies

How to list all referenced assemblies? (referenced assemblies from referenced assemblies...) and there targeting framwork (.NetCF2.0, .Net 2.0)? Are there any apps (or Reflector plugins) ? My problem is that when I deploy a CF application in VS2005 some Assemblies from the full .Net framework are deployed. But I don't know why... ...

How do exceptions work (behind the scenes) in C#

Identical to "How do exceptions work (behind the scenes) in C++", but for C#. I know that the steps below have to be performed when an exception is thrown. Find the nearest handler for the exception type; Unwind the stack up to the handler level; Call the handler; Find and call every finally blocks. How does .NET handles these opera...

c# lambda expression + reflection questions

This is mostly for educational purposes. I'm trying to create the InputMapper class, which is used in this example: var mapper = new InputMapper<SomeType>(); mapper.Map("some user input", someType => someType.IntProperty, "Input was not an integer"); mapper.Map("some user input", someType => someType.BoolProperty, "Input was not a bool"...

SL 4: simple file upload, why is this not working?

Hey guys, I am not getting any exception in the following code, however I also don't see the file which is suppose to be uploaded to the server (in this case a localhost) - could someone please point out the mistake? As an add on, I need a simple silverlight file uploader with a progress bar, but I am having a really hard time try usin...

RegistrationException - "does not have a strong name"

Hello I'm referencing a .NET DLL (which in turn references a lot of legacy COM DLLs) which is NOT strongly named. I'm referencing this from an NUnit project, which is also not signed. However when running and trying to instantiate a class, I receive the error message: RegistrationException: The class XXX does not have a strong name. ...

What other tools and frameworks i should aware of before start learning windows7 mobile programming?

I am going to learn Windows7 mobile programming soon, what are tools and frameworks I should make sure to know very well before start. For example, is know silverlight or wpf is something important? what else important? ...

checked and unchecked exception in .NET

a strange idea comes to me when I'm reading APUE(Advanced Programming in UNIX Environment). It seems that in UNIX's error handling, it has 2 types of error(FATAL & INFATAL). I feel like it's something related to checked and unchecked Exceptions in JAVA. So, to sum up, in a program, you has 2 kinds of errors, one of them is critical and...

Alternates to the Oracle .net data provider?

The oracle .net client is a big pain to install and manage. So what experience have people got with alternatives? (Telling the customer that you only support Sql Server is not always an option) ...

WebHttpBinding in WCF: how to configure it the proper way?

Trying to follow this example to make it work: http://weblogs.asp.net/kiyoshi/archive/2008/10/08/wcf-using-webhttpbinding-for-rest-services.aspx Here is my App.config: <system.serviceModel> <services> <!-- The service for the TEST WEB client --> <service name="MyServer.AAServiceType" behaviorConfiguration="Default"...

Is there a way to get the target rectangle of a Graphics object?

How can I retrieve the client rectangle (of a control) out of a Graphics object? I think the Graphics object should know its coordinates of the area to draw in, but I don't see how to actually get it. Edit: As stated in the answers, there should be access to the Control that the Graphics object was created for. This would obviously solv...

Assembly reference not found, even though the assembly is in the same directory

We're currently developing an add-in for some software. We decided to develop in .NET, even though the application is written in some native language. Since there were some problems directly creating the external interface in .NET, we decided to build a bridge DLL in C++/CLI, which does some basic initialization and then loads our manage...

Design Patterns... Where to start? (Some real-world samples)

I'm kind of new to the design patterns concept. C# is my primary programming language. (I use VB from time to time). I don't want to write sloppy code which is inflexible, not extendable and buggy. Whenever I see a design pattern in action, I enjoy the logic behind it and understand it well, But unfortunately, I'm having trouble implemen...

IndexOutofRange Exception at pkey

I get below error in follwoing code.Any ideas? Exception of type 'System.Web.HttpUnhandledException' was thrown. pKey at System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName) at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name) at System.Data.SqlClient.SqlDataReader.get_Item(String name) at ReadyCo...