Hi there,
I need to implement a random number generator into my program to choose a concatenation method at random to concatenate the user's input. I obviously do not want the same method to be generated every time the program is run. my code is as follows:
Many thanks,Code:Dim whole_user_answer As String Private Sub Command1_Click() create_string whole_user_answer End Sub Private Sub create_string(ByRef whole_user_answer) whole_user_answer = user_answer_4 & user_answer_3 & user_answer_2 & user_answer_1 MsgBox whole_user_answer 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() 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) 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) End Sub Private Sub create_medium_passwords(ByVal whole_user_answer) 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, 4) & Right$(whole_user_answer, 4) concatentation_method_2 = Left$(whole_user_answer, 3) & Right$(whole_user_answer, 4) concatentation_method_3 = Left$(whole_user_answer, 4) & Right$(whole_user_answer, 3) concatentation_method_4 = Left$(whole_user_answer, 2) & Right$(whole_user_answer, 5) concatentation_method_5 = Left$(whole_user_answer, 5) & Right$(whole_user_answer, 3) End Sub Private Sub create_long_passwords(ByVal whole_user_answer) 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, 5) & Right$(whole_user_answer, 4) concatentation_method_2 = Left$(whole_user_answer, 4) & Right$(whole_user_answer, 5) concatentation_method_3 = Left$(whole_user_answer, 5) & Right$(whole_user_answer, 5) concatentation_method_4 = Left$(whole_user_answer, 6) & Right$(whole_user_answer, 5) concatentation_method_5 = Left$(whole_user_answer, 5) & Right$(whole_user_answer, 6) End Sub




Reply With Quote