
Originally Posted by
MarMan
Interrogate the random number and call the appropriate function.
Code:
Select Case Int(rnd(1)* NumberOfFunctions ) + 1
Case 1
CallMethod1
Case 2
CallMethod2
ect.
End Select
Hi there, thanks for you reply, I am now getting a sub or function not defiended error :s. My code is as follows:
Code:
Private Sub create_user_answer(ByRef whole_user_answer)
whole_user_answer = user_answer_4 & user_answer_3 & user_answer_2 & user_answer_1
End Sub
Private Sub Form_Load()
'This sets the interval for for the specified Timer(Print_Heading) equal to 63ms
Print_Message.Interval = 63
'This enables the specified Timer(Print_Heading)
Print_Message.Enabled = True
End Sub
Private Sub Option1_Click()
MsgBox "Are you sure you wish to generate 2 passwords?"
End Sub
Private Sub Option2_Click()
MsgBox "Are you sure you wish to generate 3 passwords?"
End Sub
Private Sub Option3_Click()
MsgBox "Are you sure you wish to generate 4 passwords?"
End Sub
Private Sub Option4_Click()
MsgBox "Are you sure you want to generate passwords that are long in length?"
End Sub
Private Sub Option5_Click()
MsgBox "Are you sure you want to generate passwords that are medium length?"
End Sub
Private Sub Option6_Click()
create_short_passwords whole_user_answer
MsgBox "Are you sure you want to generate passwords that are short in length?"
End Sub
Private Sub Print_Message_Timer()
'This declares the text which shall be displayed one character after another:
title_text_string = "Please select how many passwords you wish to generate:"
Static Ptr As Long
If Ptr < Len(title_text_string) Then
Ptr = Ptr + 1
lbl_intro.Caption = Left$(title_text_string, Ptr)
Else
Ptr = 0
'This disables the specified Timer(Print_Heading)
Print_Message.Enabled = False
'This ends the IF statement
End If
End Sub
Private Sub create_short_passwords(ByVal whole_user_answer)
Select Case Int(Rnd(1) * 5) + 1
Case 1
Call concatentation_method_1
Case 2
Call concatentation_method_2
Case 3
Call concatentation_method_3
Case4
Call concatentation_method_4
Case5
Call concatentation_method_5
End Select
Dim concatentation_method_1 As String
Dim concatentation_method_2 As String
Dim concatentation_method_3 As String
Dim concatentation_method_4 As String
Dim concatentation_method_5 As String
concatentation_method_1 = Left$(whole_user_answer, 3) & Right$(whole_user_answer, 3)
concatentation_method_2 = Left$(whole_user_answer, 2) & Right$(whole_user_answer, 3)
concatentation_method_3 = Left$(whole_user_answer, 3) & Right$(whole_user_answer, 2)
concatentation_method_4 = Left$(whole_user_answer, 2) & Right$(whole_user_answer, 2)
concatentation_method_5 = Left$(whole_user_answer, 1) & Right$(whole_user_answer, 3)
MsgBox selectcase
End Sub
'I have only implemented it into Private Sub create_short_passwords
Many thanks,