Public Class Form1
    Dim FirstRun As Boolean
    Dim s As String
    Dim cid1 As DIS_CallerID_DLL.CallerID_ActiveX_class

    Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
        If FirstRun = True Then
            cid1 = New DIS_CallerID_DLL.CallerID_ActiveX_class
            FirstRun = False
        End If
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        FirstRun = True
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ListBox1.Items.Add(cid1.Total_Devices)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        cid1.Select_Device(1)
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        cid1.Enable_CallerID()
        Timer_ReadBuffer.Enabled = True
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        cid1.Show_Line_Number(False)
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        cid1.Disable_CallerID()
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        ListBox1.Items.Add(cid1.port_number)
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        ListBox1.Items.Add(cid1.Last_Status)
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        cid1.ShowOnlyNumber(True)
    End Sub

    Private Sub Timer_ReadBuffer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer_ReadBuffer.Tick
        s = cid1.Read_Buffer
        If s <> "" Then ListBox1.Items.Add(s)
    End Sub
End Class
