Public Class Form1
    Dim sir As String
    Dim sir_cautat As String
    Dim nr_ap As String
    Dim temp As Integer = -5

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        sir = InputBox("Introduceti sirul")
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        nr_ap = 0
        sir_cautat = InputBox("Introduceti sirul cautat")
        temp = InStr(sir, sir_cautat)
        If (temp <> -5) Then
            While (temp <> 0)
                temp = InStr(temp + Len(sir_cautat), sir, sir_cautat)
                nr_ap += 1
            End While
        End If
        Label2.Text = Str(nr_ap)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Close()
    End Sub
End Class
