What's new

Tutorial Clue Generator VB6

Status
Not open for further replies.

CodeWarrior

Addict
Joined
Feb 16, 2014
Posts
23
Reaction
16
Points
78
Age
39
This is a simple tutorial how to create Clue Generator using VB6

First create project and add the following object...

1. One Text1
2. One Command1 Button
Now for the code

Code:
Private Sub Command1_Click()
Dim iLen As Integer, X As Integer
Dim TempStr As String, TempLetter As String

    iLen = Len(Text1.Text)

    For X = 1 To iLen
    TempLetter = Mid(Text1.Text, X, 1)

        If TempLetter <> " " Then
            If RandBoolean = True Then TempLetter = "*"
        End If
   
    TempStr = TempStr & TempLetter
    Next X

Text1.Text = TempStr
End Sub
Private Sub Form_Load()
    Text1.Text = "CodeWarrior"
    Randomize
End Sub
Public Function RandBoolean() As Boolean
Dim X As Integer
X = RandN(1, 10)

    If X > 5 Then
        RandBoolean = True
    Else
        RandBoolean = False
    End If

End Function
Public Function RandN(ByVal Low As Long, ByVal High As Long) As Long
    RandN = Int((High - Low + 1) * Rnd) + Low
End Function

Now Press F5 and click command Button
happy happy coding

Make some credit if you are not the original creator...
Credited to ME.....
 
Status
Not open for further replies.
Back
Top