.net

Why is my destructor never called?

A CustomPropertyList class is created in my form constructor. form(String ^s) { InitializeComponent(); CustomPropertyList ^propertyList = gcnew CustomPropertyList(s); ... The CustomPropertyList class has a destructor CustomPropertyList::~CustomPropertyList() { if (MessageBox::Show("Do you want to save your changes?","Edi...

Source Code Outline Window for Visual Studio 2010

For Visual Studio 2008 there is the small but great addin "Source Outliner" on Codeplex (http://sourcecodeoutliner.codeplex.com). Does anybody know, if there is an equivalent tool for Visual Studio 2010? ...

How to override an inherited property from RichTextBox?

I wrote a custom control in C# that inherits from the RichTextBox. The purpose of this control is to contain all improvements and changes, such as modified line numbering and having the control repaint itself only when it should. Yesterday, I noticed memory spikes (and often, OOM exceptions) when accessing the Lines property of this co...

.Net - accessing multiple sql server groups / databases

My program (WCF service programed in C#) has to access multiple sql server groups and the databases within those groups (sql server). It looks like linq 2 sql definitely doesn't support this unless I create multiple dataclasses per database, and it looks like the entity framework is in the same boat. How would you go about setting up yo...

How do I databind a collection to a listbox in WPF?

I have class Employee which is something like this. class Emp { int EmpID; string EmpName; string ProjectName; } I have a list<employee> empList populated and want to show it inside the list box. I set the itemsource property of the listbox to the empList and my XAML code is as fo...

.NET or Java for web development?

In a scenario where a team want to build a very dynamic, somewhat heavy use interface (with google maps, and some geo capabilities), with lots of AJAX and JS, which is better: Java or .NET? For the database there's an option between SQLServer and PostgreSQL, and also between Windows and Linux. The objective is try to find a balance am...

Encrypting multiple elements of one xml document

Hello, I managed encrypting an xml document by encrypting an element and then replacing the element with the encrypted data. A shown in the sample code below. Public Shared Sub Encrypt(ByVal textReader As TextReader, ByVal textWriter As TextWriter, ByVal certificateName As String) Dim xmlDoc As New XmlDocument() xmlDoc.Load(tex...

Is there any "advanced" testing framework for .NET?

I am looking for a testing framework that allows me to have: Different kinds(categories) of tests. I want to be able to just run all "fast" tests or all "slow" tests. I know MSTest allows you to create lists and run then run them, but I find it annoying and distracting. I'd like to just tag the tests with attributes as I am developing ...

Fill DataTable from DataReader row by row

Hello, i want to fill a Datatable with a Datareader row by row but get an exception because the reader's columns have a different order than the Datatable's columns. Why and how does a Datatable loads itself with a Datareader correctly, even so it has a column collection with different order? I need to calculate values for every row s...

A column named [column name] already belongs to this DataTable

private void BindFields() { DataTable table = Globals.ConvertDataReaderToDataTable(DataProvider.GetFields()); _fieldCount = table.Rows.Count; dataGrid.DataSource = table; dataGrid.DataBind(); } The ConvertDataReaderToDataTable, provided by the DotNetNuke platform, throws this exception : A column named [column name...

How do I save an image in a SQL Server Database?

I want to save images that are uploaded with httppostedfilebase into a database. How do I do this? How do I structure the database fields? What code do I write to save it to the database? ...

Context.CreateQuery<T> is loading everything?

Hi All, I have been working away for EF4 and got a lot of stuff done and its working really nicely, the one problem I do have is: Context.CreateQuery returns correctly, but it is also loading ALL its related entities too!? Which is going to cause massive issues once the DB actually has real data in there. Any ideas on how to stop it ...

Convert multipage TIFF to PNG .Net

I am able to convert a single page TIFF to a PNG in .Net, however, how would I do this for a multipage TIFF? ...

Visual studio post build events -- doing them in a project instead of the event dialog

So something I've been doing recently is adding an additional project to my code solutions and doing my post build stuff programmatically in it. This project builds last and then launches itself. cool stuff I can do there is run an ILMerge automation class I created to perform merges automatically if i just give it a project folder, in...

DBML customization vs regeneration

I'm having a database with a lot of foreign key relationships defined. When I simply drag any table involved in these FK connections into the DBML editor, so as to machine-generate the DBML file, these will all be represented as associations. From here I'm able to make any changes to these associations: I might want the parent end of th...

Empty file with MVC file download.

Related to my previous question on this matter, where the file was not being produced, the file returned by the following code is now empty. My controller action is declared as follows, then has a body that generates CSV lines from records for export. The CSV generation works. [Authorize(Order = 0, Roles = "Requester,Controller,Instal...

Get a list of all UNC shared folders on a local network server

I'm trying to get a list of all shared folders available on a local intranet server. The System.IO.Directory.GetDirectories() works fine for a path like \\myServer\myShare, however I'm getting an exception for a path like \\myServer: Unhandled Exception: System.ArgumentException: The UNC path should be of the form \server\share. I...

Equivalent of Spring's "parent" in Castle Windsor

In Spring Framework (both for java and .net) i can use the following definition of objects: <object id="parentObject" type="Type1" abstract="true"> <property name="name" value="parent"/> <property name="age" value="1"/> </object> <object id="childObject" type="Type2" parent="parentObject"> <property name="name" value="override"/>...

How can my C# Windows app be notified of changes in network status without polling?

I would like to be notified when the computer's network connection is established (has a valid IP address) and I would like to do this without polling. Is there a Windows API that can provide these notifications? ...

What does mean ":" in <%: and what is the difference to <%= ?

Hi In ASP.NET MVC 2 <%: tag was introduced to replace <%= for Html helpers. But what does it mean and what is the difference to the previous one? When shall I use <%= and when <%:? Thank you ...