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.Ports; // No olvidar estos using.
//http://social.msdn.microsoft.com/Forums/es-ES/vcses/thread/86149304-c26f-4dcf-b003-198a8879decf
namespace RS232_a
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button_Abrir_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
textBox1.Text = openFileDialog1.FileName;
}
}
private void button_Enviar_Click(object sender, EventArgs e)
{
serialPort1.Open();
byte[] mBuffer = Encoding.ASCII.GetBytes(textBox1.Text);
serialPort1.Write(mBuffer, 0, mBuffer.Length);
serialPort1.Close();
MessageBox.Show("Enviado.");
}
}
}