Blog Index > Web Design > New ASP.net ToolBox files

New ASP.net ToolBox files

I have just uploaded the VB.net version of the MykeBlack ToolBox files. This file contains a small colleciton of static helper functions including the following:

  1. isNumeric - evaluates whether a string is a number
  2. isDate - tests whether a string is a valid date
  3. isValidEmail - checks whether a string conforms to a valid email address format
  4. isValidURL - checks whether a string is a valid url
  5. CreateRandomPassword - generates a random password
  6. CountStringOccurrences - counts the number of times a pattern appears in a string
  7. GetIP - returns the ip address of a visitor.
  8. FindControlRecursive - Recursive find control for HTMLGenericControls - you can modify this method to other types of controls if required.

You can download the files here:

C# version - http://www.mykeblack.com/data/fies/mykeblack.txt
VB.Net version - http://www.mykeblack.com/data/files/mykeblack-vb.txt

Once you have downloaded the files, you will need to rename to .cs (C# version) or .vb (VB.Net version).

Instructions on using the C# Helper Functions are here.

To use the VB.Net static helper functions,  do the following:

  1. Download the mykeblack-vb.txt file and rename to mykeblack.vb
  2. Copy the .vb file into your app_code folder
  3. At the top of your .cs page (or your .aspx page if you are not using a separate code behind page) reference the namespace like this:

    Imports MykeBlack
     
  4. In your code, call the functions eg like this:

    Dim myString as String = "1234567"
    if ( ToolBox.IsNumeric(myString,true) then
      ' myString is a valid number
    End If

Apologies to the guy in Lima who tried to download the .cs version and couldn't because the web server would not allow you to download .cs files directly.

Categories: Web Design13 May 2011Log in to add new posts