Buscador
YoReparo.com La Web 

Regístrate gratis para participar de los foros, o si ya estás registrado haz login.

VB. NET 2005 RECEPCION

comentario del autor Mar Ago 19, 2008 9:06 am
   
HOLA GENTE DE NUEVO YO. EH LOGRADO RECIBIR LOS DATOS DEL PUERTO SERIE Y LOS MISMO DATOS
MANDARSELOS A UN RICHARTEXTBOX.
PERO SIEMPRE LOS HAY...
LOS DATOS QUE RECIBE EL PUERTO SERIE SON 7 NUNERO Y ALREVEZ.
ASI QUE CUANDO LOS DETECTOS LOS DOY VUELTAS LOS ESPEJO UNA VES HECHO ESO SE LOS PASAO
ATRAVEZ DE UN DELEGADO A RIRCHARTEXTBOX
EL PROBLE ES QUE CUANDO ME CONECTO ME TIRA LOS 7 NUEMERO BIEN PERO AL LADO ME TIRA OTROS 7 NUEMERO
Y ASI SUSESIVAMENTE
ES COMO SI NO SE ESTUBIERA LINPIANDO UN VARIABLE
LES PASO EL COSIDO
DESDE YA MUCHISIMAS GRACIAS

Public Class FromConfigurar
Delegate Sub DelegadoCom(ByVal enviar As String)
End Class
Private Sub ButtonConectar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonConectar.Click
SerialPort1.BaudRate = 9600
SerialPort1.Parity = IO.Ports.Parity.None
SerialPort1.DataBits = 8
SerialPort1.StopBits = 1
If SerialPort1.IsOpen Then
SerialPort1.Close()
RTBConfPeso.Clear()
Else
SerialPort1.Open()
End If
End Sub
Private Sub SerialPort1_DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
If SerialPort1.ReadExisting.Length > 0 Then
Static recibidos As String
Dim valorLeido As String
Dim aux As String
Dim i As Integer
'esto seria lo que lee en el com
aux = SerialPort1.ReadExisting.ToString

For i = 1 To aux.Length
If Mid(aux, i, 1) = "=" Then
recibidos = ""
Else
recibidos = Mid(aux, i, 1) + recibidos
End If
If (recibidos.Length = 7) Then
Exit For
End If
Next
Dim valorPesado As Single
Dim Saux As String
Dim enviar As New DelegadoCom(AddressOf Me.MostrarCom)
Saux = recibidos
recibidos = ""

If String.Compare(Saux, Me.AccessibleDescription) = 0 Then
Exit Sub
End If
Me.Invoke(enviar, Saux.ToString)
End If
End Sub

Sub MostrarCom(ByVal valorPesado As String)
RTBConfPeso.Text = valorPesado
RTBConfPeso.SelectAll()
End Sub

End Class

SMD

Reputación



Hacer una pregunta

Boletín de Noticias

Reciba noticias de tecnología, tips de reparación y ofertas exclusivas.



Reglamento / P+F

Foros

Miembros / Expertos