.net

Silverlight marshalling DLLs and cross platfrom / cross browser question?

I am not too familiar with Silverlight and need some advice. We have a DLL that is written in C , I beleive. Currenlty, we have a windows application that allows a user to select some files and then pass the files (an array of file names from the file system) to the DLL to be processed. We would like to have the application be an add-in ...

How to accept ANY delegate as a parameter

I am interested in writing a method that would accept another method as a parameter but do not want to be locked into a specific signature - because I don't care about that. I am only interested whether the method throws an exception when invoked. Is there a construct in the .NET Framework that will allow me to accept any delegate as a ...

What technologies are available for a publish/subscribe model using .NET?

I'm currently working on an application where one component of the application needs to interact with multiple other system components based on certain events. These events occur based on many different triggers... some events are caused by a user's action where other users need to be notified, some events are time-based, and other even...

How do I allow CTRL-V (Paste) on a Winforms Textbox?

I have several textboxes on a windows form. I can't paste text into any of them using CTRL-V, though I can still right click and select paste. This is pretty annoying. I have tried this with the form's KeyPreview as both true and false. TextBox.ShortcutsEnabled is also true. ...

'could not load type' error

I have a WCF service. now, I need to create a client that consumes my service. when I try to add a service reference from Visual Studio, this is what I get an error message : "Could not load type 'System.Data.Design.TypedDataSetSchemaImporterExtensionFS35' from assembly 'System.Design,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f...

Detecting a -301 DB2 error in .NET

I have an application in VB.NET which is generating some -301 errors in DB2 on an update statement using an ADO.NET connection. It appears that DB2 reports the occurrence of this error, but then fixes whatever data was wrong and resubmits. This fixing and resubmission comes with additional overhead and in turn real dollars and cents cos...

NUnit "missing" GPSVC.DLL on Windows 7/64

I recently upgraded from Vista/32 to Win7/64. On my old machine, everything was working fine. Unfortunately, on my new machine NUnit won't load my unit tests, with the error message "System.IO.FileNotFoundException: Could not load file or assembly 'UnitTest' or one of its dependencies. The system cannot find the file specified". (Act...

Linq to entities casting error

I am getting this error and I have collection of anonymous Datarows and each item contains two datarows. How to cast this? Unable to cast object of type 'WhereSelectEnumerableIterator`2[VB$AnonymousType_0`2[System.Data.DataRow,System.Data.DataRow],VB$AnonymousType_0`2[System.Data.DataRow,System.Data.DataRow]]' to type 'System.Data.Enume...

DateTime/bool and Null values in .Net

Utilizing .Net I am inheriting from an older class that has DateTime and bool parameters as part of its constructor. These values are pulled from a SQL database and in the SQL database these values can be null. When I populate my class and call the base constructor this fails because DateTime and bool cannot have null values in .Net. ...

Automatically launch winforms app after install completes?

Launching your app automatically immediately after install is suprisingly tricky. The advice that's out there if you google the problem is varied but most of it unsatisfactory. We're using the built in Setup & Deployment project in Visual Studio. So, how to do it? What doesn't work: The simplest solution suggested is to add your app...

How to control DTD reading with .NET?

A C# program of ours reads an XML file. The XML file has standalone='no' header. The DOCTYPE used to look like: <!DOCTYPE foo SYSTEM "silly.dtd"> where silly.dtd is not sitting right there next to the file. For various reasons, I changed this to <!DOCTYPE foo PUBLIC "-//Some Public Id" "urn:outerspace:silly.dtd"> I expected noth...

Lucene .NET 2.3.2 Security Exception - Medium trust Issues

I'm only partially able to get Lucene .NET to work on GoDaddy. It throws a security exception on this line: Hits hits = searcher.Search(query, filter); Here are the details of this exception: Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required perm...

Detecting grayscale images with .Net

I am scanning documents to JPG images. The scanner must scan all pages as color or all pages as black and white. Since many of my pages are color, I must scan all pages as color. After the scanning is complete, I would like to examine the images with .Net and try to detect what images are black and white so that I can convert those im...

Splitting a multipage TIFF image - With .NET and IronPython

I had a scanned multipage TIFF image and needed to split each page out into individual files. This is easy to do in by leveraging the .NET framework and C#, but since I did not have all the development tools installed on the machine I was using, I instead opted to use IronPython (via ipy.exe) to quickly script the processing logic. Usi...

Regular expression help

Need regular expression to change below url abc.aspx?str=blue+lagoon&id=1234 to /blog/blue-lagoon/ Appreciate all your help. ...

Is there a C# equivalent of Sonar?

Is there a C# equivalent of Sonar? ...

blob download counter in .net

Hi I need to add a download counter to know how many times my BLOB data is read and displayed from the database (to determine traffic). How and where can I add this counter? Many thanks! I have a dynamically generated list of links such as <a href="page.aspx?DocID=IDhere">Document filename</a> which direct to a display page. My displ...

How do I CheckOnClick in a CheckedListbox but only when over the checkbox?

I have a CheckedListBox. I would like to be able to select items when I click on the text but check/uncheck them when I click on the checkbox area on the left. If I set CheckOnClick then the items are checked and unchecked whenever I click, even on the text, so that's no good. But if I clear CheckOnClick then I have to click twice to ...

How can I best avoid using reserved or key words in my language or framework?

Naming things is hard. When naming my classes, variables, and methods I strive to avoid collisions with reserved words or keywords in my languages (MSSQL, VB.NET or C#, HTML, CSS, jQuery) and framework (.NET). Too often I make mistakes and don't realize it until it's too late to easily go back and rename. A scenario: (1) first create ...

C# - How to print objects in an array using for/foreach?

I have a homework assigment to iterate through an object array and print out these objects using for and foreach. I'm stuck on how to do that. Questions When you use a foreach loop, don't you have to declare the object? So the object declared in a foreach loop is null, because it doesn't call any constructors in my Employee class. Cod...