HOWTO:
Short articles describing the use of a particular part of the .NET framework. Usually stuff that was not well documented if at all and that I want to share with folks.
Scott Hanselman has a post on his weblog about getting a shared network printer to work in DOS. That's not really all that tough and actually got me thinking about a similar experience I had recently. In my previous job I had the great misfortune of having to support a DOS based point-of-sale application. When you sell stuff, you need to give out receipts. We used the nice little T-88's from Epson. Very nice little units that were fairly reliable. When it came time to buy some more, I chose to go...
You want to display a value as currency using the format of the culture of the local machine. The documentation is not too clear on how you use this stuff so I have a little sample that I managed to get working. Here you go: In C#: using System;using System.Globalization; namespace ConsoleApplication1{ class Class1 { [STAThread] static void Main(string[] args) { NumberFormatInfo numberInfo = CultureInfo.CurrentCulture.... double myAmount = 10.815; Console.WriteLine(Math.Roun...
Accessing data from a URL is a fairly straightforward exercise. Many services have implemented a REST style interface to allow queries to be submitted and the results returned to the client, usually as XML. For example: StringBuilder restURL = new StringBuilder();HttpWebRequest restRequest;HttpWebResponse restResponse;XmlDocument xDoc = new XmlDocument(); // build the URL String - dr is a DataReader// ADO.NET code omitted for clarityrestURL.AppendFormat...