.net

VSTO: can't open another Excel file, while first file is blocked by modal window from Add-in

We can't open another Excel file, while first file is blocked by modal window from our Add-in. Closing the dialog window unfreezes all pending file opens. Excel version is 2007. Is there a programmatic work around, that would allow Microsoft Excel 2007 to open the second file in a separate window, while first window is waiting for the A...

WPF Datagrid "Select All" button - "Unselect All" too?

Hi, I would like to know if it would be possible to add functionality to the 'Select All' button in the top left of a datagrid so that it also unselects all rows? I have a method attached to a button which does this, but it would be great if I could fire this method from the Select All button, to keep functionality in the same part of t...

Troubleshooting Assembly Linker Error, C++, VS 2005

Using Visual Studio 2005 with the latest Service Pack. I have a managed C++ solution with 38 projects (that I've just inherited.) When I build this solution, I'm receiving the following error from the Assembly Linker: "error AL1019: Metadata failure while creating assembly -- The process cannot access the file because it is being us...

Inheritance/design issue with domain entities that can be individual or combined

I have completely confused myself trying to design the necessary interfaces and abstracts to accomplish loading of domain entities that can be used by themselves as well as combined into an aggregate. Wow. That was a buzzword mouthful. Essentially, I have two objects that I would like to have base-type "load" functionality, but when t...

reading a jpeg file in c#.

Hello. I have a doubt in c#. How to read a jpeg or bmp file using c#? and how to store the pixel's RGB values in array? Then how to check whether the value is already exist or not? ...

change db name in connection string at runtime in Entity Framework

Hello guys, In my project I want to run some unit tests on the DAL layer that is using EntityFramework. I'm creating from scrips a new database before each run of the tests (in order to have always the same initial data when doing the tests). At the end of the tests, this database is dropped, (all is made automatically with the help of ...

Microsoft.ExceptionMessageBox not being "found"

I have a winform solution that I deploy through clickOnce. There is the Main Project and then a Project called psWinForms. That project has a Reference to Microsoft.ExceptionMessageBox that I use in my custom error reporting. I have psWinForms as a reference in my Main Project with Copy Local = True. I have Microsoft.ExceptionMessa...

How can I take a screenshot of a Winforms control/form in C#?

I have a listview control that is on a winforms form. It fills the full screen but there are more items there than the screen can show. How can I take a screenshot of the whole control as if I could display the whole contents of the listview on screen? So if the whole listview takes 1000 x 4000 pixels, then I want an image/bitmap of tha...

Interesting Security Question for .net developers

As all .net developers know its possible to encrypt values in web.config. I have other XML configuration files, that I read in from serialization techniques, not using system.configuration but instead serializing to a strongly typed object. Its now become a requirement for me to encrypt some values in these xml file, not the whole X...

How to refactor this code?

how can i refactor this code down to one method or something? if (!string.IsNullOrEmpty(_gridModel.Header)) _gridModel.Header += ","; if (item != null) _gridModel.Header += item.Header; if (!string.IsNullOrEmpty(_gridModel.Width)) _gridModel.Width += ",...

Should I wait for a new version of WCF or should I start learning WCF 3.5 ?

I want to start learning WCF, but I don’t want to realize that by the time I've learn it, that I will have to do it all over again by the arrival of .NET 4.0 So will the upcoming WCF only have some minor changes, which someone familiar with older version of WCF will have no troubles learning in a short amount of time, or will I again ha...

C# Create Gradient Image

How can I create a gradient image (with a given height & width, start color and end color) using C#? Does anybody have a simple sample snippet? Thank you! ...

In .NET, which is best, mystring.Length == 0 or mystring == string.Empty ?

Possible Duplicate: Checking for string contents? string Length Vs Empty String In .NET, which is best, if (mystring.Length == 0) or if (mystring == string.Empty) It seems that these would have the same effect, but which would be best behind the scenes? ...

.NET valid property names

Where is the documentation for valid property names in .NET? Obviously things like space, * or & aren't valid in a property name, but where is this documented? ...

Is it a bad idea to add a period to a .Net solution file?

If I was using a "Partitioned Single Solution" strategy to build my .Net projects and solutions, could anyone comment on, or share any experiences about why it would be a bad idea to include dot notation in my solution names as such...     master.sln     master.sub.sln ...also let me know if you think it's a good idea? Please note that...

Solution with over 100 projects takes over five minutes to build

I have a solution with over 100 projects. It takes a long time to build, and sometimes Visual Studio crashes during the build. How can I deal with this issue and minimize the pain? Have we gone horribly, horribly wrong somewhere? Some background on the problem: We are using CAB with WPF, and each module has a ui assembly and a "serv...

Call an haskell function in .net

Hi, I want to use an Haskell function with the following type :: string -> string from a C# programm. I want to use hs-dotnet to bridge both worlds, the author claim that it's possible, but provide no sample of this case. The only samples provided are the one to use .net from haskell. Does anyone got a sample of this use, or got an ide...

.NET & Excel Interop: Copying User Selection to Clipboard

Fairly straightforward scenario, for which I can't seem to find an answer anywhere: I am using a Microsoft WebBrowser ActiveX control (AxSHDocVw.AxWebBrowser) in a Windows Forms application. The WebBrowser control is used to display Excel workbooks in the application. I can obtain a reference to the internal document as a Microsoft.O...

Request for code review: does such XmlSerializer factory have any drawbacks?

Hi! People tend to recommend to cache XmlSerializer instances. Is this still actual? (if no, when has it become so?). Also I came up with the following code and ask to review it. Does it have any drawbacks? Will it use many threads\cores for different types? How can I improve it? The code: public static class SerializerFactory<T> ...

Are StructureMap profiles thread safe?

I was thinking of using StructureMap's profiles to facilitate offering up slight differences in behavior in my web app based on the authenticated user's type. My question is, if I do something like ObjectFactory.Profile = Session["UserType"]; is it going to be thread-safe or will simultaneous requests potentially interfere with each o...