The type or namespace name 'Form1' could not be found (are you missing a using directive or an assem

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
hi there,
i am trying to write a simple program from scratch trying to get data sent between COMM ports 1 and 2 and displayed in a text box
<pre class="prettyprint 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;

namespace Application2
{
public partial class Form1 : Form
{
private SerialPort port1 = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
private SerialPort port2 = new SerialPort("COM2", 9600, Parity.None, 8, StopBits.One);

public Form1()
{
InitializeComponent();
port2.Open();
port2.DataReceived += new SerialDataReceivedEventHandler(SerialReceive);
}

public void SerialReceive(object sender, SerialDataReceivedEventArgs e)
{

textBox1.Text = (port2.ReadTo("!%"));

}

private void button1_Click(object sender, EventArgs e)
{
port1.Open();
port1.WriteLine("12345");
port1.Close();
}



}
}
[/code]
i need to be able to compile before i can proceed and make other changes.<br/>


View the full article
 
Back
Top