Entradas

Mostrando entradas de septiembre, 2010

Control puerto serial visual 2008

Imagen
Imports System.IO.Ports Imports System.Windows.Forms Public Class Form1 Dim vector() As String Dim contador As Integer Dim combo As New ComboBox Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load combo.Items.AddRange(SerialPort.GetPortNames) If combo.Items.Count > 1 Then SerialPort1.PortName = combo.Items.Item(1) SerialPort1.Open() If SerialPort1.IsOpen Then Timer1.Enabled = True End If End If End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Try SerialPort1.Write(TextBox1.Text) Label1.Text = SerialPort1.ReadExisting Catch ex As Exception End Try End Sub End Class