codigovisual

2
using System; using System.Collections.Gener ic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; namespace WindowsFormsApplication1 {  public partial class Form1 : Form  {  public Form1()  {  CheckForIllegalCrossTh readCalls = false;  InitializeComponent();  try  {  serialPort1.Open();  }  catch (Exception ex)  {  MessageBox.Show("Error al abrir el puerto serie: " + ex.Message) ;  }  }  private void PuertoSerie_DataReceived(object sender,System.IO.Ports.Seri alDataReceivedEventArg s e)  {  }  private void Form1_Load(object sender, EventArgs e)  { }  private void Enviar_Click(object sender, EventArgs e)  {  //serialPort1.WriteLine("hola");  }  private void Leer_Click(object sender, EventArgs e)  {  // Create an instance of StreamReader to read from a file.  // The using statement also closes the StreamReader.  StreamReader sr = new StreamReader("C:\\Users\\jhon\\Desktop\\PROYEC TOS\\proter\\pocoyo.txt");  int counter = 0;  string line;  // Read and display lines from the file until the end of // the file is reached.  while ((line = sr.ReadLine()) != null)  {  //TextoEntrada.Text = line.ToString() + "\n";  serialPort1.WriteLine(line);  counter++;

Upload: alvaro-callejas

Post on 14-Oct-2015

3 views

Category:

Documents


0 download

DESCRIPTION

vaspvakvionvkjijbvanivjnivnONvaspvakvionvkjijbvanivjnivnONVVvaspvakvionvkjijbvanivjnivnONvaspvakvionvkjijbvanivjnivnONVVVVVVVvaspvakvionvkjijbvanivjnivnONvaspvakvionvkjijbvanivjnivnON

TRANSCRIPT

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.IO;namespace WindowsFormsApplication1{ public partial class Form1 : Form { public Form1() { CheckForIllegalCrossThreadCalls = false; InitializeComponent(); try { serialPort1.Open(); } catch (Exception ex) { MessageBox.Show("Error al abrir el puerto serie: " + ex.Message); } } private void PuertoSerie_DataReceived(object sender,System.IO.Ports.SerialDataReceivedEventArgs e) { } private void Form1_Load(object sender, EventArgs e) { } private void Enviar_Click(object sender, EventArgs e) { //serialPort1.WriteLine("hola"); } private void Leer_Click(object sender, EventArgs e) { // Create an instance of StreamReader to read from a file. // The using statement also closes the StreamReader. StreamReader sr = new StreamReader("C:\\Users\\jhon\\Desktop\\PROYECTOS\\proter\\pocoyo.txt"); int counter = 0; string line; // Read and display lines from the file until the end of // the file is reached. while ((line = sr.ReadLine()) != null) { //TextoEntrada.Text = line.ToString() + "\n"; serialPort1.WriteLine(line); counter++; } } }}