VB random char (Program pengacak Huruf)

Buat tombol Command1

Form :

Code:

Option Explicit

Private Sub Command1_Click()
Dim i As Integer

Dim Losen As String

For i = 1 To 20
If i Mod 2 > 0 Then
Losen = Losen & RandomChar(65, 90)
Else
Losen = Losen & RandomNum(0, 10)
End If

Next i
MsgBox Losen
End Sub

Module:

Option Explicit

Public Function RandomChar(Lower As Integer, High As Integer) As String

Randomize
RandomChar = Chr((High – Lower) * Rnd + Lower)

End Function

Public Function RandomNum(Lower As Integer, High As Integer) As Integer
Randomize
RandomNum = ((High – Lower) * Rnd + Lower \ 1)
End Function

Image

3 Komentar

  1. hey gimana cara mengacak nama2 yang ada di salah satu field database..

    misalnya di databaseku ada nama, gimana caranya supaya kita bisa mengacak nama yang akan muncul….

    tapi nama yang akan muncul tersebut ada di database kita yang telah kita buat sebelumnya.

    thanksss…

    mohon dibales di emailku…

    atau di

    krisna.wiranata@yahoo.com

  2. thanks

  3. makasih infonya boss..
    salam kenal fazriesoft


Comments RSS TrackBack Identifier URI

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s