Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. COM Port in Visual C# 2005

COM Port in Visual C# 2005

Scheduled Pinned Locked Moved C#
csharpcomtutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Juan Pablo G C
    wrote on last edited by
    #1

    There's a new possibility in the System.IO that is accesing to Port Coms: System.IO.Ports, I'm not good with delegates and I'm trying to make a program that when receives a data from the serial port makes and event: private void Form1_Load(object sender, EventArgs e) { ptocom.ReceivedEvent +=new SerialReceivedEventHandler(ptocom_ReceivedEvent); //It's not complete but I dont know how to put it well } void ptocom_ReceivedEvent(object sender, SerialReceivedEventArgs e) { //Type tipo; ? //tipo = e.EventType.GetType(); ? //taken.Text = tipo.ToString(); ? //taken.Text = buffer; //throw new NotImplementedException(); <-thats appear automatic ? } private void button1_Click(object sender, EventArgs e) { SerialPort ptocom = new SerialPort("COM1", 9600, System.IO.Ports.Parity.None, 8, StopBits.One); string buffer = "j"; ptocom.Open(); ptocom.ReadTo(buffer); } Thats all I could discover about using this new possibilities but It doesnt work, any Idea? Juan Pablo García Coello. Electronic Engineer. Projectist at the Electronic Dept.Instituto de Astrofísica de Canarias. Spain

    W 1 Reply Last reply
    0
    • J Juan Pablo G C

      There's a new possibility in the System.IO that is accesing to Port Coms: System.IO.Ports, I'm not good with delegates and I'm trying to make a program that when receives a data from the serial port makes and event: private void Form1_Load(object sender, EventArgs e) { ptocom.ReceivedEvent +=new SerialReceivedEventHandler(ptocom_ReceivedEvent); //It's not complete but I dont know how to put it well } void ptocom_ReceivedEvent(object sender, SerialReceivedEventArgs e) { //Type tipo; ? //tipo = e.EventType.GetType(); ? //taken.Text = tipo.ToString(); ? //taken.Text = buffer; //throw new NotImplementedException(); <-thats appear automatic ? } private void button1_Click(object sender, EventArgs e) { SerialPort ptocom = new SerialPort("COM1", 9600, System.IO.Ports.Parity.None, 8, StopBits.One); string buffer = "j"; ptocom.Open(); ptocom.ReadTo(buffer); } Thats all I could discover about using this new possibilities but It doesnt work, any Idea? Juan Pablo García Coello. Electronic Engineer. Projectist at the Electronic Dept.Instituto de Astrofísica de Canarias. Spain

      W Offline
      W Offline
      warnerja
      wrote on last edited by
      #2

      Duplicated here: http://www.codeproject.com/script/comments/forums.asp?forumid=1649&tid=1023891&exp=1&select=1023891#xx1024239xx[^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups