Results 1 to 2 of 2

Thread: Why does it do that . . .

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    225

    Why does it do that . . .

    For some reason names 5,7,10-20 dont work and there are no error messagesin cmd_AGe

    Private Sub cmdweight_Click()
    Dim number(1 To 20) As Integer
    Dim counter, temp As Integer
    Dim temp2 As String
    Dim nme(1 To 20) As String
    Dim height(1 To 20) As Integer
    Dim weight(1 To 20) As Integer

    number(1) = 2
    number(2) = 4
    number(3) = 6
    number(4) = 12
    number(5) = 9
    number(6) = 16
    number(7) = 22
    number(8) = 34
    number(9) = 21
    number(10) = 14
    number(11) = 27
    number(12) = 18
    number(13) = 33
    number(14) = 89
    number(15) = 43
    number(16) = 32
    number(17) = 29
    number(18) = 31
    number(19) = 19
    number(20) = 20

    nme(1) = "Vincent VanGogh"
    nme(2) = "Wilfrid Laurier"
    nme(3) = "Abraham Lincoln"
    nme(4) = "Ludwig Beethoven"
    nme(5) = "George Byron"
    nme(6) = "George Washington"
    nme(7) = "Winston Churchill"
    nme(8) = "Albert Einstein"
    nme(9) = "Leonardo DaVinci"
    nme(10) = "Issac Newton"
    nme(11) = "Galile Galileo"
    nme(12) = "Stephen Hawking"
    nme(13) = "Edgar Allan Poe"
    nme(14) = "Carl Gauss"
    nme(15) = "William Shakespeare"
    nme(16) = "Maria Curie"
    nme(17) = "John Nash"
    nme(18) = "James Michener"
    nme(19) = "Mahatma Gandhi"
    nme(20) = "Genghis Khan"

    height(1) = "150"
    height(2) = "57 "
    height(3) = "66"
    height(4) = "59"
    height(5) = "53"
    height(6) = "52"
    height(7) = "55"
    height(8) = "61"
    height(9) = "52"
    height(10) = "54"
    height(11) = "63"
    height(12) = "52"
    height(13) = "55 "
    height(14) = "52"
    height(15) = "57"
    height(16) = "58"
    height(17) = "62"
    height(18) = "54"
    height(19) = "59"
    height(20) = "58"

    weight(1) = "150"
    weight(2) = "57 "
    weight(3) = "66"
    weight(4) = "59"
    weight(5) = "53"
    weight(6) = "52"
    weight(7) = "55"
    weight(8) = "61"
    weight(9) = "52"
    weight(10) = "54"
    weight(11) = "63"
    weight(12) = "52"
    weight(13) = "55"
    weight(14) = "52"
    weight(15) = "57"
    weight(16) = "58"
    weight(17) = "62"
    weight(18) = "54"
    weight(19) = "59"
    weight(20) = "58"

    For Index = 1 To 18
    For counter = 1 To 19
    If height(counter) > height(counter + 1) Then
    temp = height(counter)
    height(counter) = height(counter + 1)
    nme(counter) = nme(counter + 1)
    height(counter + 1) = temp
    nme(counter + 1) = temp2

    End If
    Next counter
    Next Index
    End Sub



    Private Sub Form_Load()

    Me.WindowState = vbMaximized
    End Sub


    Private Sub Label1_Click()

    Label1.Caption = " This is the list to be sorted" & vbCrLf & _
    "Vincent VanGogh 2 15 30" & vbCrLf & _
    "Wilfrid Laurier 4 57 45" & vbCrLf & _
    "Abraham Lincoln 6 66 52" & vbCrLf & _
    "Ludwig Beethoven 59 12 110" & vbCrLf & _
    "George Byron 12 53 95 " & vbCrLf & _
    "George Washington 9 52 87 " & vbCrLf & _
    "Winston Churchill 16 55 130" & vbCrLf & _
    "Albert Einstein 22 61 101" & vbCrLf & _
    "Leonardo DaVinci 34 52 98 " & vbCrLf & _
    "Issac Newton 21 54 136 " & vbCrLf & _
    "Galile Galileo 14 63 101" & vbCrLf & _
    "Stephen Hawking 27 18 113 " & vbCrLf & _
    "Edgar Allan Poe 52 55 125 " & vbCrLf & _
    "Carl Gauss 33 55 140" & vbCrLf & _
    "William Shakespeare 33 52 114" & vbCrLf & _
    "Maria Curie 89 57 111" & vbCrLf & _
    "John Nash 43 58 150" & vbCrLf & _
    "James Michener 32 52 165" & vbCrLf & _
    "Mahatma Gandhi 29 57 134 " & vbCrLf & _
    "Genghis Khan 19 58 106"

    End Sub

    Private Sub Command8_Click()
    End
    End Sub

    Private Sub cmdAGe_Click()
    Dim number(1 To 20) As Integer
    Dim counter, temp As Integer
    Dim temp2 As String
    Dim nme(1 To 20) As String
    Dim height(1 To 20) As Integer
    Dim weight(1 To 20) As Integer

    number(1) = 2
    number(2) = 4
    number(3) = 6
    number(4) = 12
    number(5) = 9
    number(6) = 16
    number(7) = 22
    number(8) = 34
    number(9) = 21
    number(10) = 14
    number(11) = 27
    number(12) = 18
    number(13) = 33
    number(14) = 89
    number(15) = 43
    number(16) = 32
    number(17) = 29
    number(18) = 31
    number(19) = 19
    number(20) = 20

    nme(1) = "Vincent VanGogh"
    nme(2) = "Wilfrid Laurier"
    nme(3) = "Abraham Lincoln"
    nme(4) = "Ludwig Beethoven"
    nme(5) = "George Byron"
    nme(6) = "George Washington"
    nme(7) = "Winston Churchill"
    nme(8) = "Albert Einstein"
    nme(9) = "Leonardo DaVinci"
    nme(10) = "Issac Newton"
    nme(11) = "Galile Galileo"
    nme(12) = "Stephen Hawking"
    nme(13) = "Edgar Allan Poe"
    nme(14) = "Carl Gauss"
    nme(15) = "William Shakespeare"
    nme(16) = "Maria Curie"
    nme(17) = "John Nash"
    nme(18) = "James Michener"
    nme(19) = "Mahatma Gandhi"
    nme(20) = "Genghis Khan"

    height(1) = "150"
    height(2) = "57 "
    height(3) = "66"
    height(4) = "59"
    height(5) = "53"
    height(6) = "52"
    height(7) = "55"
    height(8) = "61"
    height(9) = "52"
    height(10) = "54"
    height(11) = "63"
    height(12) = "52"
    height(13) = "55 "
    height(14) = "52"
    height(15) = "57"
    height(16) = "58"
    height(17) = "62"
    height(18) = "54"
    height(19) = "59"
    height(20) = "58"

    weight(1) = "150"
    weight(2) = "57 "
    weight(3) = "66"
    weight(4) = "59"
    weight(5) = "53"
    weight(6) = "52"
    weight(7) = "55"
    weight(8) = "61"
    weight(9) = "52"
    weight(10) = "54"
    weight(11) = "63"
    weight(12) = "52"
    weight(13) = "55"
    weight(14) = "52"
    weight(15) = "57"
    weight(16) = "58"
    weight(17) = "62"
    weight(18) = "54"
    weight(19) = "59"
    weight(20) = "58"




    For Index = 1 To 18
    For counter = 1 To 19
    If number(counter) > number(counter + 1) Then
    temp = number(counter)
    number(counter) = number(counter + 1)
    nme(counter) = nme(counter + 1)
    number(counter + 1) = temp
    nme(counter + 1) = temp2

    End If
    Next counter
    Next Index

    Print "This is the sorted list"
    Print " Age"; " Height"; " Weight"
    Print nme(1); number(1); height(1); weight(1)
    Print nme(2); number(2); height(2); weight(2)
    Print nme(3); number(3); height(3); weight(3)
    Print nme(4); number(4); height(4); weight(4)
    Print nme(5); number(5); height(5); weight(5)
    Print nme(6); number(6); height(6); weight(6)
    Print nme(7); number(7); height(7); weight(7)
    Print nme(8); number(8); height(8); weight(8)
    Print nme(9); number(9); height(9); weight(9)
    Print nme(10); number(10); height(10); weight(10)
    Print nme(11); number(11); height(11); weight(11)
    Print nme(12); number(12); height(12); weight(12)
    Print nme(13); number(13); height(13); weight(13)
    Print nme(14); number(14); height(14); weight(14)
    Print nme(15); number(15); height(15); weight(15)
    Print nme(16); number(16); height(16); weight(16)
    Print nme(17); number(17); height(17); weight(17)
    Print nme(18); number(18); height(18); weight(18)
    Print nme(19); number(19); height(19); weight(19)
    Print nme(20); number(20); height(20); weight(20)
    Print




    End Sub

  2. #2
    Hyperactive Member Alan777's Avatar
    Join Date
    Jan 2001
    Location
    New Zealand
    Posts
    303
    You wanna study For... Next loops and multi dimention Arrays and stuff.
    Do yourself a favor!
    "Today's mighty oak is just yesterday's nut,
    that held its ground."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width