Show MenuHide Menu

Tag: .net

VB.NET Export dataSet to Excel 2007

June 13, 2013


The perennial problem of exporting to Excel from an ASP.NET application: Excel has been uninstalled, upgraded or the web app has been removed to a new virtual instance with no Excel. So to get around I have started using openXML and imported the excellent class developed and provided by Mike Gledhill. It has worked first time and all of the time on any app I have deployed.

VB.NET Downloading Zip Files

December 3, 2012
If zip files are being downloaded without .zip extension in VB.NET use the following:

Response.ContentType = "application/x-zip-compressed";

And if there is a problem where the zip file
is being downloaded without a proper file name ensure that the following has the file name only and not the path.

Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName );


BC30456: ‘InitializeCulture’ is not a member of

June 21, 2012
The most irritating and unpredictable error message I have encountered in ASP.NET has to be

BC30456: ‘InitializeCulture’ is not a member of…

Thankfully there is a fix here, the one that worked for me was switching off Debug in Web.config


Prevent postback of HTML button in ASP.NET page

June 19, 2012
Need to call some JavaScript from an HTML button and prevent button from causing a postback/page re-load on ASP.NET page?

Simply add return false; to OnClick as shown below:

<button onclick=’doTest();return false;’>Click me</button>

jquery-regular-logocsharp3 and Ajax

April 23, 2012
This article is very useful for looking at ways of “Ajaxifying” (has to be a word? if it isn’t Copyright jhunter 2012) your web app when retrieving data from backend.
Personal favourite has to be handler (.ashx) pages!

Click here for full article

Validate email address in

October 29, 2010

Simple, elegant, effective way of validating email addresses in VB.NET, on VB forums:

    Function EmailAddressCheck(ByVal emailAddress As String) As Boolean

        Dim pattern As String = “^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$”

        Dim emailAddressMatch As Match = Regex.Match(emailAddress, pattern)

        If emailAddressMatch.Success Then

            EmailAddressCheck = True


            EmailAddressCheck = False

        End If

    End Function


Insert copyright symbol into VB Code

September 15, 2010

Hold down the ALT key and type 02217

Full list available here:



ASP.NET Response.Redirect to new window

August 10, 2010

Very simple: OnClientClick=“ =’_blank’;”



Making a tag cloud in ASP.NET

April 28, 2010

Great article on 4guysfromrolla explaining how to create a tag cloud in Read it here

ASP.NET Server control for rounded corners

April 13, 2010

Scott Mitchell has an excellent article over at on how to create a custom server control for rounded corners…no graphic design experience required 🙂

Click here to view