Большой Воронежский Форум
» Программирование>C# и COM порт
ant0n 10:19 28.02.2008
подскажите кто знает, что не правильно, пытаюсь произвести простейшую запись в порт но Visual Studio .Net ругается.
пишу в Visual Studio .Net 2003:

вот листинг:

using System;
using System.IO;
using System.IO.Ports;

namespace ConsoleApplication2
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class SerialPort
{
System.IO.Ports.SerialPort port = new System.IO.Ports.Serialport();

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
port.PortName = "COM1";
port.WriteTimeout = 500;
port.ReadTimeout = 500;
port.BaudRate = 9600;
port.Parity = Parity.None;
port.DataBits = 8;
port.StopBits = StopBits.One;
port.Handshake = Handshake.RequestToSend;
port.DtrEnable = true;
port.RtsEnable = true;
port.NewLine = System.Environment.NewLine;
port.Open();
port.WriteLine("AT#CLS=8");
port.Close();



//
// TODO: Add code to start application here
//
}
}
}

сообщения об ошибке:
(3): The type or namespace name 'Ports' does not exist in the class or namespace 'System.IO' (are you missing an assembly reference?)

(12): The type or namespace name 'Ports' does not exist in the class or namespace 'System.IO' (are you missing an assembly reference?) [Ответ]
M0l0t 10:16 29.02.2008
не прогаю на шарпе, но пишет то он тебе, что "тип Ports не существует в классе System.IO". может ошибся с названием типа? [Ответ]
McCoder 10:05 01.03.2008
Работа с COM появилась только в .NET Framework 2.0.
Ставь Visual Studio 2005 [Ответ]
ant0n 10:09 02.03.2008
буду ставить 2005 и пробовать,M0l0t true if true McCoder [Ответ]
M0l0t 12:14 02.03.2008
ant0n, эт да) [Ответ]
Вверх