Tuesday, March 12th, 2013
Hi all, You can use the following extension method to parse any string that is split by a delimiter. It will take care of most issues associated with splitting strings (quotes, etc) and works very well in almost every scenario I have used it in. Good one for the library of extension methods, definitely. [...]
Tuesday, March 12th, 2013
Haven’t written anything on here for a while – so I am going to start getting back on it. Here’s some nice code to get a directory listing from FTP. You get back a list of FTPListDetail objects which can be used to pass to further implementations, such as a download / downloadasync etc. It [...]
Hi all, I was looking around for an application which sits in the system tray and watches for key combinations to automatically change your monitor refresh rate – I assumed somebody would have written something to do this, but couldn’t find a single app, so I wrote something. I have uploaded it here :- http://downloads.seesharpdot.net/files/RefreshSwitcher.zip [...]
Tuesday, February 15th, 2011
Ever wanted to copy and paste from Excel into a System.Data.DataTable for displaying in a DataGrid? Here’s some quick and dirty code to do just that :- private void PasteFromExcel() { DataTable tbl = new DataTable(); tbl.TableName = ”ImportedTable”; List<string> data = new List<string>(ClipboardData.Split(‘\n’)); bool firstRow = true; if (data.Count > 0 && string.IsNullOrWhiteSpace(data[data.Count - 1])) { data.RemoveAt(data.Count - 1); } foreach (string iterationRow in data) { string row = iterationRow; if (row.EndsWith(“\r”)) { row = row.Substring(0, row.Length - ”\r”.Length); } string[] rowData = row.Split(new char[] { ’\r’, ’\x09′ }); DataRow newRow = tbl.NewRow(); if (firstRow) { int colNumber = 0; foreach (string value in rowData) { if (string.IsNullOrWhiteSpace(value)) { tbl.Columns.Add(string.Format(“[BLANK{0}]“, colNumber)); } [...]
Tuesday, February 15th, 2011
I thought I would post this custom browser I wrote for a project I am working on. It allows you to access the zoom function of the Internet Explorer browser (AxWebBrowser) by calling a Zoom method (passing in a whole number, expressed as percentage). I also added an InjectCSS() method which allows you to insert [...]
Also filed in C# Development
|
Tagged AttachInterfaces, axIWebBrowser2, AxWebBrowser, ExecWB, IWebBrowser2, OLECMDID, OLECMDID_OPTICAL_GETZOOMRANG, OLECMDID_OPTICAL_ZOOM, OPTICAL_ZOOM, user32.dll, WebBrowser
|
Permalink
|
Tuesday, February 15th, 2011
I recently had to write some code to perform an upload to a WCF service, and there was a chance that the files could be a touch on the large side so streaming seemed like the best option. There is quite a limited amount of information about this subject – and configuring the web config [...]
If you ever need to get delivery reports when you send emails from within .NET – here is a nice code snippet which does it. I used this approach to stamp emails with a “Mail-CustomData” header which contained information leading back to a database entity. I then watched the mailReplyToAddress with a small program I [...]
Is anyone else having problems with Visual Studio 2010 intellisense? I find myself constantly having to guess the name of properties and events in my web controls (mostly UserControls, but also ASP.NET Ajax controls) and it’s starting to get to me! I haven’t seen anyone complaining about this yet, so I thought it was definitely [...]
Haven’t posted for quite a while – reason being is that I started a new job with a stockbroker in London and have been very busy. Here’s the first of many new posts on useful .NET code snippets. Recursively looking through directories for files has always been a bit of a fiddle – here’s a [...]
Monday, December 21st, 2009
OK – After a few people have asked .. I have finally rewritten the Amazon Web Services tool to use my newly updated code. It’s a fresh rewrite with some special wordlist matching code, and it seems to work nicely. It is available here as a Windows Installer (.msi) package http://downloads.seesharpdot.net/files/CoverArtInstaller.msi So – all you [...]