.net

Multi-Column Selector

Hi there. I am searching for some hybrid of ComboBox and ListView and I am wondering why there exists nothing like that, although I feel it's a quite natural wish to have it. In more detail: A WPF ItemsControl should have an ItemsSource of all applicable items. These items have multiple properties, say ID:int, Name:string and Descripti...

Fields vs Properties for private class variables

For private class variables, which one is preferred? If you have a property like int limit, you want it to be: int Limit {get; set;} and use it inside the class, like so: this.Limit Is there a reason to use it or not use it? Maybe for performance reasons? I wonder if this is a good practice. ...

Controlling other windows from C# app

I'm writing a C# app that will aggregate control of several applications (WMP, Google Earth, etc.). For apps that I am not writing myself, I am launching as a process, so I have their handles (handle = Process.Start("C:\whatever.exe"); is the code, I believe). For it to work smoothly, I need to be able to control the minimized/maximized...

Are there any tricks for counting the number of lines in a text file?

Say you have a text file - what's the fastest and/or most memory efficient way to determine the number of lines of text in that file? Is it simply a matter of scanning through it character by character and looking for newline characters? ...

.net service bus recommendations?

We are in need of a distributed architecture messaging system/service bus with the capability of Publish/Subscribe. Does anyone have any reccomendations for a framework that we can use for .net applications? ...

What happens when you close a .NET console application?

Is a method such as OnClosed(EventArgs e) called? Update Ended up using code from the following url: http://osdir.com/ml/windows.devel.dotnet.clr/2003-11/msg00214.html ...

How do I Remove a table column in MVC?

I want have two columns and based on a condition, include or remove a third. using all the if statements seems a bit redundant. Is there another way to do this? <table style="width: 60%;"> <tr> <th>Name</th> <th>Age</th> <th>Other</th> </tr> ...

Good example of Quantity or Money class.

Does someone konow a good .NET implementation of Quantity (with Unit of Measure) or Money (with Currency) classess/patterns in .NET ? ...

Searching for a objectGUID in AD

I'm using the Active Directory Explorer from Mark Russinovich. It is a great tool. I'm using it to navigate active directory to make sure my program that uses DirectorySearcher from .NET returns correct data. Something happens though, when I try to search inside my program with DirectorySearcher for objectGUID, if I pass in the actual ...

My own tableheader?

I want to make a table header: The steps I have taken Made a user control Placed a TableLayoutPanel on it(this is basically a grid layout?) Added and removed the number of columns/rows I wanted Placed a label in each cell For each label set its dock to fill and borderstyle to fixedsingle However the borders are not lined up against ...

OPTS command on FtpWebRequest/FtpWebResponse

I'm using the FtpWebRequest and FtpWebResponse objects in the System.Net namespace to issue a LIST command. The problem I'm having is that the FTP server I'm connecting to does not have the OPTS command implemented. Is there a way of preventing FtpWebRequest from issuing the OPTS command? ...

.Net and SQL Server Diagnostics

Our company has many .Net applications on many servers which utilize many different SQL Servers. We do not have a clear idea of what is using what. It would be great to get a full picture of what's going on down to the smallest details. Especially important is to know what App is connecting to what Database. Idea's so far have been to a...

.NET zlib Stream compatible with Actionscript ByteArray.uncompress

I can't seem to get a stream that Flex 3 want's to decompress. I've tried: System.IO.Compression.GZipStream System.IO.Compression.DeflateStream ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream zlib.ZOutputStream None of these seem to make ByteArray.uncompress happy, i.e. I get Error #2058: There was an error ...

SqlBulkCopy into table with composite primary key

I'm trying to use SqlBulkCopy to insert new rows into my DB table by manually populating a DataTable w/in my application. This works fine for all tables except the table that has a composite primary key made up of 3 columns. Whenever I try to SqlBulkCopy anything into this table, I get the following error: Violation of PRIMARY KEY con...

YesNo MessageBox not closing when x-button clicked

When I open a MessageBox with options YesNo, the (usually) cancelling cross in the upper right is shown but has no effect. System.Windows.MessageBox.Show("Really, really?", "Are you sure?", MessageBoxButton.YesNo); If I offer YesNoCancel as options, clicking the cross closes the Dialog with DialogResult Cancel. System.Windows.Message...

Double to string conversion without scientific notation

How to convert a double into a floating-point string representation without scientific notation in the .NET Framework? "Small" samples (effective numbers may be of any size, such as 1.5E200 or 1e-200) : 3248971234698200000000000000000000000000000000 0.00000000000000000000000000000000000023897356978234562 None of the standard number...

Problem with Images on TreeView

I have a TreeView with ItemHeight=16 and CheckBoxes=true. I want to show images that are 8x16 pixels in size on the nodes. But when I do this, the "Plus/Minus" and "CheckBoxes" change their size (get smaller). How can I fix this? I don't want to use a 16x16 image because I don't want to loose those 8 pixels with white space. Any sugges...

my guessing game. Help appreciated

I'm using nopcommerce as my shop and I have managed to get it working like a dream, but now I'm getting cocky and need the help of people wiser than me. I want to give a 100% discount to any customer that can correctly guess my middle names. I want to provide feedback to any customer that gets any of the letters correct so that they can...

Convert file path to a file URI?

Does the .NET Framework have any methods for converting a path (e.g. "C:\whatever.txt") into a file URI (e.g. "file:///C:/whatever.txt")? The Uri class has the reverse (from a file URI to absolute path), but nothing as far as I can find for converting to a file URI. Also, this is NOT a ASP.NET application. Thanks! ...

Best practices for naming user controls?

I've created quite a few user controls to encapsulate GUI functionality used in multiple places in my app. I've noticed I usually have a tendency to describe the function of the control and tack "Control" on the end of the name, but not always. I'd like to standardize the naming and wanted to know if there's a best practice for naming Us...