Home > Software engineering >  Novice self-study VB6, consult the code problems
Novice self-study VB6, consult the code problems

Time:11-30

# # # are now finding that had problems with n2 to zero, could you tell me how to modify the # # #
Private Sub Command1_Click ()
Dim (a) As String 'define the value of a array
Dim a2 () As String 'defined by value a2 array
Dim a3 () As String 'define the value of a3 array
Dim a4 () As String 'defined by value a4 array
Dim the a5 () As String 'definition by value a5 array
Dim a6 () As String 'values define the a6 array
Dim a7 () As String 'values define the a7 array
Dim a8 () As String 'definition by value a8 array
Dim a9 () As String 'values define the a9 array
Dim a10 a10 () As String 'define the value of the array
Dim a11 () As String 'defined by value a11 array
Dim I, j, t, n cycle variables As Integer '
Dim X (1 To 6) As String, y As Integer 'define a 6 d array subscript and loop variable
% % Dim M1, M2, M3, M4, M5, M6 %
Dim n2 and n3 and n4 interchange, n5 and n6, n7, n8, n9, n10, next 11 As Integer 'count variables
Dim, k2, k3, k4, k5, k6, k7, k8, k9, k10/19 dated, k11 As Integer 'screening cycle variables
Dim num (1 To 6) As Long 'definition of an array receiving qualified array
Text12=""
A=Split (Text1. Text, "") 'in a array
A2=Split (Text2. Text, "") 'in the a2 array
A3=Split (Text3. Text, "") 'in the a3 array
A4=Split (Text4. Text, "") 'in the a4 array
A5=Split (Text5. Text, "") 'in the a5 array
A6=Split (Text6. Text, "") 'in the a6 array
A7=Split (Text7. Text, "") 'in the a7 array
A8=Split (Text8. Text, "") 'in the a8 array
A9=Split (Text9. Text, "") 'in the a9 array
A10=Split (Text10) Text, "") 'in a10 array
A11=Split (Text11. Text, "") 'in a11 array
Randomize 'initialize the random number generator
N2=0


For I=1 To UBound (a) - 1
For j=I + 1 To UBound (a)
If Val (a) (I) & gt; Val (a (j)) Then t=a (I) : a (I)=a (j) : a (j)=t 'a sort the array size
Next
Next

For M1=0 To UBound (a) - 5
Num (1)=a (M1) 'number assigned to iterate through a set of the first array num
For j=0 To UBound (a2) 'inner loop control array a2
If Val (num (1))=Val (a2) (j) Then n2=(n + 1 'If the same number for every, n2 + 1
Next j
For M2 equals M1 + 1 To UBound (a) - 4
Num (2)=a (M2) 'number assigned to iterate through a set of the second array num
For j=0 To UBound (a2) 'inner loop control array a2
If Val (num (2))=Val (a2) (j) Then n2=(n + 1 'If the same number for every, n2 + 1
Next j
For the M3=M2 + 1 To UBound (a) - 3
Num (3)=a (M3) 'number assigned to iterate through a set of the third array num
For j=0 To UBound (a2) 'inner loop control array a2
If Val (num (3))=Val (a2) (j) Then n2=(n + 1 'If the same number for every, n2 + 1
Next j
For the M4=M3 + 1 To UBound (a) - 2
Num (4)=a (M4) 'number assigned to iterate through a set of 4 array num
For j=0 To UBound (a2) 'inner loop control array a2
If Val (num (4))=Val (a2) (j) Then n2=(n + 1 'If the same number for every, n2 + 1
Next j
For the M5=M4 + 1 To UBound (a) - 1
Num (5)=a (M5) 'walking down the fifth number assigned to an array of group a num
For j=0 To UBound (a2) 'inner loop control array a2
If Val (num (5))=Val (a2) (j) Then n2=(n + 1 'If the same number for every, n2 + 1
Next j
For M6=M5 + 1 To UBound (a)
Num (6)=a (M6) 'iterate through a set of 6 number assigned to an array num
For j=0 To UBound (a2) 'inner loop control array a2
If Val (num (6))=Val (a2) (j) Then n2=(n + 1 'If the same number for every, n2 + 1
Next j

If n2=0 Then 'If the condition is empty, the direct output
For I=1 To 6
Text12=Text12 & amp; Num (I) & amp; "
"Next I
Text12=Text12 & amp; VbCrLf
DoEvents
Else 'if the condition is not null

If Val (Combo1. Text)=Val (Combo2. Text) Then 'situation a
If n2=Val (Combo1. Text) Or n2=Val (Combo2. Text) Then 'If qualified, the output
For I=1 To 6
Text12=Text12 & amp; Num (I) & amp; "
"Next I
Text12=Text12 & amp; VbCrLf
DoEvents
The Else 'if it does not comply with the conditions of no output
Text12=Text12
End the If
ElseIf Val (Combo1. Text) & lt; Val (Combo2. Text) Then 'situation.
If Val (Combo1. Text) & lt;=n2 & lt;=Val (Combo2. Text) Then 'if qualified, the output
For I=1 To 6
Text12=Text12 & amp; Num (I) & amp; "
"Next I

Text12=Text12 & amp; VbCrLf
DoEvents
The Else 'if it does not comply with the conditions of no output
Text12=Text12

End the If
ElseIf Val (Combo1. Text) & gt; Val (Combo2. Text) Then 'three
If Val (Combo1. Text) & gt;=n2 & gt;=Val (Combo2. Text) Then 'if qualified, the output
For I=1 To 6
Text12=Text12 & amp; Num (I) & amp; "
"Next I

Text12=Text12 & amp; VbCrLf
DoEvents
The Else 'if it does not comply with the conditions of no output
Text12=Text12

End the If
End the If
End the If

Next
Next
Next
Next
Next
Next

End Sub

CodePudding user response:

Didn't see your n2 which have the problem of "zero"...


I'm afraid is you don't understand "grammar rules!
The two writing, make you feel it "after one logic operations, n2 '0', continue to the next step of logic operation", right?

 ElseIf Val (Combo1. Text) & lt; Val (Combo2. Text) Then 'situation. 
'If Val (Combo1. Text) & lt;=n2 & lt;=Val (Combo2. Text) Then 'if qualified, the output
'the above sentence should be changed to:
If Val (Combo1. Text) & lt;=n2 And n2 & lt;=Val (Combo2. Text) Then

ElseIf Val (Combo1. Text) & gt; Val (Combo2. Text) Then 'three
'If Val (Combo1. Text) & gt;=n2 & gt;=Val (Combo2. Text) Then 'if qualified, the output
'the above sentence should be changed to:
If Val (Combo1. Text) & gt;=n2 And n2 & gt;=Val (Combo2. Text) Then

CodePudding user response:

Don't say your code logic suddenly thrown so simple a long, didn't see the code,
  • Related