Categories
IT Programming

How to open a new tab in an existing Internet Explorer instance in C#

A problem that I recently came across is when opening a new Internet Explorer instance in C# the user was being required to login to a site that they had already logged in to. It was pretty clear that this was because the existing session was not being used as a new IE process was […]

Categories
IT Programming

How to save to PDF in C# using Word 2003 or 2007 without SP 2 (using Pechkin)

I’ve spent a significant amount of time lately on trying to solve this issue and came across many, many barriers, so I thought I’d share with you my findings and the solution that I used. Whilst Word 2007 SP2 (or Word 2007 using the Save As PDF Add-in) and above natively support saving documents as […]

Categories
IT Programming

How to force open Internet Explorer 32-bit or 64-bit in C#

On a project I was recently working on it was necessary to open a URL in Internet Explorer (a requirement of it to work correctly, unfortunately) and we had a few “bugs” which seemed to randomly occurred. It turned out this was due to Process.Start(“iexplore.exe”) loading 32-bit IE whereas it seems we required 64-bit.

Categories
Programming

How to remove warning: The ‘log4net’ element is not declared

So I’ve seen a lot of questions around this issue with generally the only resolution being: “It’s a warning, just ignore this”. Whilst it is safe to do this, for pedants like me there is a true resolution. There are a few places around the net to get this but (like a lot of issues […]

Categories
Programming

Colour your Log4Net events in your RichTextBox

You’re most probably here because you have already read my article How to watch your log through your application in Log4Net and you’re thinking “that’s great, but I need to somehow differentiate all of this output!” – either that or you just really need a handy way to format certain keywords within your RichTextBox.

Categories
Programming

Scrolling textbox when text is added, but not if the user has scrolled

You may (or may not) have read my recent article How to watch your log through your application in Log4Net which allows you to append Log4Net events direct in to a textbox – if so, you may then also have come across a frustration that I also had, which is that whenever the texbox is […]

Categories
Programming

How to watch your log through your application in Log4Net

Log4Net is an excellent logging system that allows you to clearly see what your application is doing and when, making it very easy to debug your app during development but especially during production. I have previously demonstrated how to use Log4Net in C# which enables you to log output to your console for the former […]

Categories
Programming

How to access WebAPI from a .Net 3.5 client in C#

So, like me, you may have come across some incompatibility within your WebAPI client that means you can’t use .Net 4/4.5 (which is required to use HttpClient and HttpResponseMessage etc.) – or you’re writing a web service to fill in due to this incompatibility. This solution should allow you to access your API (using POST) […]

Categories
Programming

Installing your C# project in Visual Studio 2012 (or earlier)

So you may or may not be aware that Visual Studio 2012 no longer has a built in project that will install your application for you – I can understand why this is, as it allows third parties to develop these and lets them focus on improving the programming experience, but I can also understand […]

Categories
Programming

C# DateTime.AddMinutes increments months at midnight

So last night I was writing an application that would process trunk logs from Connect Assist’s ShoreTel phone system which would allow the raw per-call data to be turned in to trunk usage stats (but that’s another story).