home *** CD-ROM | disk | FTP | other *** search
- Public Class Form1
- Inherits System.Windows.Forms.Form
-
- #Region " Windows Form Designer generated code "
-
- Public Sub New()
- MyBase.New()
-
- 'This call is required by the Windows Form Designer.
- InitializeComponent()
-
- 'Add any initialization after the InitializeComponent() call
-
- End Sub
-
- 'Form overrides dispose to clean up the component list.
- Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
- If disposing Then
- If Not (components Is Nothing) Then
- components.Dispose()
- End If
- End If
- MyBase.Dispose(disposing)
- End Sub
-
- 'Required by the Windows Form Designer
- Private components As System.ComponentModel.IContainer
-
- 'NOTE: The following procedure is required by the Windows Form Designer
- 'It can be modified using the Windows Form Designer.
- 'Do not modify it using the code editor.
- Friend WithEvents TestComms As System.Windows.Forms.Button
- Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
- Friend WithEvents cc1 As comm.CommControl
- Friend WithEvents cc2 As comm.CommControl
- Friend WithEvents SetDTR1 As System.Windows.Forms.Button
- Friend WithEvents SetDTR2 As System.Windows.Forms.Button
- Friend WithEvents ClrDTR1 As System.Windows.Forms.Button
- Friend WithEvents ClrDTR2 As System.Windows.Forms.Button
- Friend WithEvents SetRTS1 As System.Windows.Forms.Button
- Friend WithEvents SetRTS2 As System.Windows.Forms.Button
- Friend WithEvents ClrRTS1 As System.Windows.Forms.Button
- Friend WithEvents ClrRTS2 As System.Windows.Forms.Button
- Friend WithEvents Button2 As System.Windows.Forms.Button
- Friend WithEvents DSR1 As System.Windows.Forms.CheckBox
- Friend WithEvents CTS1 As System.Windows.Forms.CheckBox
- Friend WithEvents DSR2 As System.Windows.Forms.CheckBox
- Friend WithEvents CTS2 As System.Windows.Forms.CheckBox
- Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
- Friend WithEvents Button1 As System.Windows.Forms.Button
- Friend WithEvents Label1 As System.Windows.Forms.Label
- Friend WithEvents Label2 As System.Windows.Forms.Label
- <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
- Me.TestComms = New System.Windows.Forms.Button()
- Me.cc1 = New comm.CommControl()
- Me.TextBox1 = New System.Windows.Forms.TextBox()
- Me.cc2 = New comm.CommControl()
- Me.SetDTR1 = New System.Windows.Forms.Button()
- Me.SetDTR2 = New System.Windows.Forms.Button()
- Me.ClrDTR1 = New System.Windows.Forms.Button()
- Me.ClrDTR2 = New System.Windows.Forms.Button()
- Me.SetRTS1 = New System.Windows.Forms.Button()
- Me.SetRTS2 = New System.Windows.Forms.Button()
- Me.ClrRTS1 = New System.Windows.Forms.Button()
- Me.ClrRTS2 = New System.Windows.Forms.Button()
- Me.Button2 = New System.Windows.Forms.Button()
- Me.DSR1 = New System.Windows.Forms.CheckBox()
- Me.CTS1 = New System.Windows.Forms.CheckBox()
- Me.DSR2 = New System.Windows.Forms.CheckBox()
- Me.CTS2 = New System.Windows.Forms.CheckBox()
- Me.TextBox2 = New System.Windows.Forms.TextBox()
- Me.Button1 = New System.Windows.Forms.Button()
- Me.Label1 = New System.Windows.Forms.Label()
- Me.Label2 = New System.Windows.Forms.Label()
- Me.SuspendLayout()
- '
- 'TestComms
- '
- Me.TestComms.Location = New System.Drawing.Point(24, 8)
- Me.TestComms.Name = "TestComms"
- Me.TestComms.Size = New System.Drawing.Size(112, 32)
- Me.TestComms.TabIndex = 2
- Me.TestComms.Text = "Initialize"
- '
- 'cc1
- '
- Me.cc1.Location = New System.Drawing.Point(648, 216)
- Me.cc1.Name = "cc1"
- Me.cc1.Size = New System.Drawing.Size(88, 40)
- Me.cc1.TabIndex = 3
- '
- 'TextBox1
- '
- Me.TextBox1.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
- Me.TextBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.TextBox1.Location = New System.Drawing.Point(24, 320)
- Me.TextBox1.Multiline = True
- Me.TextBox1.Name = "TextBox1"
- Me.TextBox1.ReadOnly = True
- Me.TextBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
- Me.TextBox1.Size = New System.Drawing.Size(304, 192)
- Me.TextBox1.TabIndex = 4
- Me.TextBox1.Text = ""
- '
- 'cc2
- '
- Me.cc2.Location = New System.Drawing.Point(640, 280)
- Me.cc2.Name = "cc2"
- Me.cc2.Size = New System.Drawing.Size(88, 40)
- Me.cc2.TabIndex = 6
- '
- 'SetDTR1
- '
- Me.SetDTR1.Location = New System.Drawing.Point(360, 32)
- Me.SetDTR1.Name = "SetDTR1"
- Me.SetDTR1.Size = New System.Drawing.Size(136, 32)
- Me.SetDTR1.TabIndex = 7
- Me.SetDTR1.Text = "Set DTR on Port 1"
- '
- 'SetDTR2
- '
- Me.SetDTR2.Location = New System.Drawing.Point(360, 72)
- Me.SetDTR2.Name = "SetDTR2"
- Me.SetDTR2.Size = New System.Drawing.Size(136, 32)
- Me.SetDTR2.TabIndex = 8
- Me.SetDTR2.Text = "Set DTR on Port 2"
- '
- 'ClrDTR1
- '
- Me.ClrDTR1.Location = New System.Drawing.Point(360, 112)
- Me.ClrDTR1.Name = "ClrDTR1"
- Me.ClrDTR1.Size = New System.Drawing.Size(136, 32)
- Me.ClrDTR1.TabIndex = 9
- Me.ClrDTR1.Text = "Clear DTR on Port 1"
- '
- 'ClrDTR2
- '
- Me.ClrDTR2.Location = New System.Drawing.Point(360, 152)
- Me.ClrDTR2.Name = "ClrDTR2"
- Me.ClrDTR2.Size = New System.Drawing.Size(136, 32)
- Me.ClrDTR2.TabIndex = 10
- Me.ClrDTR2.Text = "Clear DTR on Port 2"
- '
- 'SetRTS1
- '
- Me.SetRTS1.Location = New System.Drawing.Point(520, 32)
- Me.SetRTS1.Name = "SetRTS1"
- Me.SetRTS1.Size = New System.Drawing.Size(136, 32)
- Me.SetRTS1.TabIndex = 11
- Me.SetRTS1.Text = "Set RTS on Port 1"
- '
- 'SetRTS2
- '
- Me.SetRTS2.Location = New System.Drawing.Point(520, 72)
- Me.SetRTS2.Name = "SetRTS2"
- Me.SetRTS2.Size = New System.Drawing.Size(136, 32)
- Me.SetRTS2.TabIndex = 12
- Me.SetRTS2.Text = "Set RTS on Port 2"
- '
- 'ClrRTS1
- '
- Me.ClrRTS1.Location = New System.Drawing.Point(520, 112)
- Me.ClrRTS1.Name = "ClrRTS1"
- Me.ClrRTS1.Size = New System.Drawing.Size(136, 32)
- Me.ClrRTS1.TabIndex = 13
- Me.ClrRTS1.Text = "Clear RTS on Port 1"
- '
- 'ClrRTS2
- '
- Me.ClrRTS2.Location = New System.Drawing.Point(520, 152)
- Me.ClrRTS2.Name = "ClrRTS2"
- Me.ClrRTS2.Size = New System.Drawing.Size(136, 32)
- Me.ClrRTS2.TabIndex = 14
- Me.ClrRTS2.Text = "Clear RTS on Port 2"
- '
- 'Button2
- '
- Me.Button2.Location = New System.Drawing.Point(368, 352)
- Me.Button2.Name = "Button2"
- Me.Button2.Size = New System.Drawing.Size(192, 32)
- Me.Button2.TabIndex = 15
- Me.Button2.Text = "Check"
- '
- 'DSR1
- '
- Me.DSR1.Location = New System.Drawing.Point(376, 280)
- Me.DSR1.Name = "DSR1"
- Me.DSR1.TabIndex = 16
- Me.DSR1.Text = "DSR1"
- '
- 'CTS1
- '
- Me.CTS1.Location = New System.Drawing.Point(376, 312)
- Me.CTS1.Name = "CTS1"
- Me.CTS1.TabIndex = 17
- Me.CTS1.Text = "CTS1"
- '
- 'DSR2
- '
- Me.DSR2.Location = New System.Drawing.Point(504, 280)
- Me.DSR2.Name = "DSR2"
- Me.DSR2.TabIndex = 18
- Me.DSR2.Text = "DSR2"
- '
- 'CTS2
- '
- Me.CTS2.Location = New System.Drawing.Point(504, 312)
- Me.CTS2.Name = "CTS2"
- Me.CTS2.TabIndex = 19
- Me.CTS2.Text = "CTS2"
- '
- 'TextBox2
- '
- Me.TextBox2.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(192, Byte), CType(192, Byte))
- Me.TextBox2.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.TextBox2.Location = New System.Drawing.Point(24, 72)
- Me.TextBox2.Multiline = True
- Me.TextBox2.Name = "TextBox2"
- Me.TextBox2.ReadOnly = True
- Me.TextBox2.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
- Me.TextBox2.Size = New System.Drawing.Size(304, 200)
- Me.TextBox2.TabIndex = 20
- Me.TextBox2.Text = ""
- '
- 'Button1
- '
- Me.Button1.Location = New System.Drawing.Point(568, 352)
- Me.Button1.Name = "Button1"
- Me.Button1.Size = New System.Drawing.Size(192, 32)
- Me.Button1.TabIndex = 21
- Me.Button1.Text = "Write Test"
- '
- 'Label1
- '
- Me.Label1.Location = New System.Drawing.Point(32, 48)
- Me.Label1.Name = "Label1"
- Me.Label1.Size = New System.Drawing.Size(136, 16)
- Me.Label1.TabIndex = 22
- Me.Label1.Text = "Received on port 2"
- '
- 'Label2
- '
- Me.Label2.Location = New System.Drawing.Point(24, 296)
- Me.Label2.Name = "Label2"
- Me.Label2.Size = New System.Drawing.Size(136, 16)
- Me.Label2.TabIndex = 23
- Me.Label2.Text = "Received on port 1"
- '
- 'Form1
- '
- Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15)
- Me.ClientSize = New System.Drawing.Size(760, 536)
- Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label2, Me.Label1, Me.Button1, Me.TextBox2, Me.CTS2, Me.DSR2, Me.CTS1, Me.DSR1, Me.Button2, Me.ClrRTS2, Me.ClrRTS1, Me.SetRTS2, Me.SetRTS1, Me.ClrDTR2, Me.ClrDTR1, Me.SetDTR2, Me.SetDTR1, Me.cc2, Me.TextBox1, Me.cc1, Me.TestComms})
- Me.Name = "Form1"
- Me.Text = "Form1"
- Me.ResumeLayout(False)
-
- End Sub
-
- #End Region
-
- Private Sub TestComms_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TestComms.Click
-
- cc1.OpenWithEvents(1, 9600)
- cc2.OpenWithEvents(2, 9600)
- End Sub
-
- Private Sub commevent1(ByVal m As Integer) Handles cc1.commEvent
- Dim s As String
- If m And cc1.EV_CTS Then
- s += "1:CTS " + vbCrLf
- End If
- If m And cc1.EV_DSR Then
- s += "1:DSR " + vbCrLf
- End If
- If m And cc1.EV_RING Then
- s += "1:RI " + vbCrLf
- End If
- If m And cc1.EV_RLSD Then
- s += "1:CD " + vbCrLf
- End If
- If m And cc1.EV_TXEMPTY Then
- s += "1:TXEMPTY " + vbCrLf
- End If
- If m And cc1.EV_RXCHAR Then
- s += "1:RX " + vbCrLf
- s += cc2.Read + vbCrLf
- End If
- TextBox1.Text += s
- End Sub
-
- Private Sub commevent2(ByVal m As Integer) Handles cc2.commEvent
- Dim s As String
-
- If m And cc2.EV_CTS Then
- s += "2:CTS " + vbCrLf
- End If
- If m And cc2.EV_DSR Then
- s += "2:DSR " + vbCrLf
- End If
- If m And cc2.EV_RING Then
- s += "2:RI " + vbCrLf
- End If
- If m And cc2.EV_RLSD Then
- s += "2:CD " + vbCrLf
- End If
- If m And cc2.EV_TXEMPTY Then
- s += "2:TXEMPTY " + vbCrLf
- End If
- If m And cc2.EV_RXCHAR Then
- s += "2:RX " + vbCrLf
- s += cc2.Read + vbCrLf
- End If
- TextBox2.Text += s
- End Sub
-
- Private Sub SetDTR1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SetDTR1.Click
- cc1.DTR = True
- End Sub
-
- Private Sub SetDTR2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SetDTR2.Click
- cc2.DTR = True
- End Sub
-
- Private Sub ClrDTR1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClrDTR1.Click
- cc1.DTR = False
- End Sub
-
- Private Sub ClrDTR2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClrDTR2.Click
- cc2.DTR = False
- End Sub
-
- Private Sub SetRTS1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SetRTS1.Click
- cc1.RTS = True
- End Sub
-
- Private Sub SetRTS2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SetRTS2.Click
- cc2.RTS = True
- End Sub
-
- Private Sub ClrRTS1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClrRTS1.Click
- cc1.RTS = False
- End Sub
-
- Private Sub ClrRTS2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClrRTS2.Click
- cc2.RTS = False
- End Sub
-
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
-
- CTS1.Checked = cc1.CTS
- CTS2.Checked = cc2.CTS
- DSR1.Checked = cc1.DSR
- DSR2.Checked = cc2.DSR
-
- End Sub
-
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- cc1.Write("hello, world")
- End Sub
-
- End Class
-