Public Class Form1
    Dim vector(99) As Integer
    Dim lungime As Integer
    Dim temp As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Randomize()
        lungime = CInt(Int((100 - 10 + 1) * Rnd() + 10))
        For i = 0 To lungime - 1
            vector(i) = CInt(Int(150 - 0 + 1) * Rnd() + 0)
        Next
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Randomize()
        temp = 0
        For i = 0 To lungime - 1
            If Val(TextBox1.Text) = vector(i) Then
                temp = 1
                MsgBox("Numarul exista!", 32)
                Exit For
            End If
        Next
        If temp = 0 Then
            MsgBox("Numarul nu exista!", 16)
        End If
    End Sub
End Class
