This is default featured post 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

Senin, 25 Juli 2011

Membuat validasi email dengan vb



Ketika iseng-iseng buka vb . Eh keingat gimana ya membuat validasi email. Akhirnya muter-muter deh di internet . Dan akhirnya nemu juga . Ini dia script untuk mengecek email di textbox valid atau nggak.





Silahkan kopi code dibawah ini :


Function IsEmail(ByVal Str As String) As Boolean
Set r = CreateObject("VBScript.RegExp")
r.IgnoreCase = True
r.Pattern = "^[\w-\.]+@\w+\.\w+$"
IsEmail = r.Test(Str)
End Function


Dari Function tersebut akan bernilai True atau False. Untuk penerapan di vb nya tinggal Ketikan code berikut di textbox tertentu:


Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If IsEmail(Me.Text1.Text) = False Then
MsgBox "Salah"
Else
MsgBox "Benar"
End If
End If
End Sub



Terima Kasih Semoga bermanfaat koding sederhana ini