To use it, download the DLL and add a reference to it. Make sure to import the Namespace to your project like this,

Imports nK0deExtendedMethods

Merge method (for Images)

This extended method combines two images in one Picturebox. You only have to pass the second image as a parameter.

Dim image1, image2 As Image

image1 = Image.FromFile("C:\Users\nK0de\Pictures\pic01.jpg")
image2 = Image.FromFile("C:\Users\nK0de\Pictures\pic02.jpg")

PictureBox1.Image = image1.Merge(image2)

Fit method (for Images)

This method re-sizes the image that's passed to a Picturebox to make it fit within the Picturebox. You have to pass the height and the width of the Picturebox as parameters.

Dim image1 As Image
Dim pH, pW As Integer

pH = PictureBox2.Height
pW = PictureBox2.Width

image1 = Image.FromFile("C:\Users\nK0de\Pictures\pic01.jpg")

PictureBox1.Image = image3.Fit(pH, pW)

IsEmail method (for Strings)

This method checks the passed string is a valid email address using a regex pattern and returns True is successful.

If IsEmail(TextBox1.Text) = True Then
    MessageBox.Show("Valid email address")
    MessageBox.Show("Invalid email address")
End If

Center method (for Forms)

This method is useful when developing a MDI application and you have to center the child forms inside the parent form. In the event where the child form is invoked,

Dim f As Form = frmChild

frmChild.MdiParent = Me
frmChild.Location = Center(f)

ReverseString method (for Strings)

This method is useful for C# developers in a situation which you have to reverse a string. VB.NET provides a built0in method to do this but C# doesn't.

Dim str As String = TextBox1.Text

Label1.Text = str.ReverseString()

Last edited Mar 31, 2012 at 5:19 PM by nK0de, version 5


No comments yet.