Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

VISUAL BASIC programming question. If anyone could help me with this sequence ch

ID: 3821850 • Letter: V

Question

VISUAL BASIC programming question. If anyone could help me with this sequence check it would be much appreciated! I can't seem to get the code to return the out of sequence numbers. See the problem below.

Design parameters: Design a Form that has a multi-column Listbox and a Button to start the execution. Name the button and double click the it to create the Event Handler.

Dim intSeq() as Integer =   { 1, 2, 3, 4, 5, 7, 6, 8, 9, 10,
                11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
                21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
                30, 32, 33, 35, 34, 36, 37, 38, 39, 40,
                41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
               51, 53, 52, 54, 55, 56, 58, 57, 59, 60,
                61, 62, 63, 65, 64, 66, 67, 68, 69, 70,
                71, 72, 74, 73, 76, 75, 77, 78, 79, 80,
                81, 82, 83, 84, 85, 86, 88, 87, 89, 90,
                91, 92, 93, 94, 95, 96, 97, 98, 99, 100 }

1. Use a For loop display the array in the Listbox. There should be 4 columns of numbers with 25 numbers per column. Also, sum all the numbers in the array. Create a Label in the Form to display this sum.

2. Use another new For loop to perform a Sequence Check of the numbers in the array. A number is Out of Sequence if the current number is greater than the next number.  Here is an example of a simpler array:

1 2 4  3 5 7 8 9 11  10 12 13

The program would display in the Listbox:

Out of Sequence
4
11

Because the 4 is greater than the next number 3, and 11 is greater than the next number 10.

Explanation / Answer

Public Class Form2

Dim i As Integer = 0

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMainMenu.Click
Me.Close()
End Sub

Private Sub btnEnterPatient_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnterPatient.Click


ReDim Preserve Names(0 To i)
Names(i) = txtPatientName.Text

ReDim Preserve Heights(0 To i)
Heights(i) = txtPatientHeight.Text

ReDim Preserve Weights(0 To i)
Weights(i) = txtPatientWeight.Text

i = i + 1

Label1.Text = i

End Sub
End Class