Вот пример написал простой.
- Public Class Form1
- Dim nomer(10) As Integer
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Dim max, min As Integer
- Dim i As Integer
- max = nomer(1)
- min = nomer(1)
- For i = 2 To 10
- If max < nomer(i) Then max = nomer(i)
- If min > nomer(i) Then min = nomer(i)
- Next
- MsgBox("Maximum = " & max & " Mininum = " & min)
- End Sub
-
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Dim i As Integer
- For i = 1 To 10
- Dim rnd As Random
- rnd = New Random
- nomer(i) = i * rnd.Next(1, 100)
- ListBox1.Items.Add(nomer(i).ToString)
- Next
- End Sub
- End Class
Ответить
|