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. error for parent form serialport object...

error for parent form serialport object...

Scheduled Pinned Locked Moved C#
visual-studiohelpquestion
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.
  • I Offline
    I Offline
    IamHuM
    wrote on last edited by
    #1

    hi... In my application... I have declared a SerialPort object in parent form & i am accessing it from a child form but its giving an error in port 'open' method. Can anybody tell me where i am going wrong... Here is sample code for some more information... //In parent form public SerialPort comport = new SerialPort(); child_Form childForm= new child_Form();//this is the child form child_Form .MdiParent = this; comport.PortName = "COM1"; //In child form if(!((ParentForm)this.MdiParent).comport.IsOpen) ((ParentForm)this.MdiParent).comport.Open(); // Getting error on this line ((ParentForm)this.MdiParent).comport.Write("send the text on serial Port"); I am getting intellisense for parent's 'comport' in child form. above two sentence in child are write or wrong...? where i'm doing mistake...? Thanks in adavance, Vinay

    T 1 Reply Last reply
    0
    • I IamHuM

      hi... In my application... I have declared a SerialPort object in parent form & i am accessing it from a child form but its giving an error in port 'open' method. Can anybody tell me where i am going wrong... Here is sample code for some more information... //In parent form public SerialPort comport = new SerialPort(); child_Form childForm= new child_Form();//this is the child form child_Form .MdiParent = this; comport.PortName = "COM1"; //In child form if(!((ParentForm)this.MdiParent).comport.IsOpen) ((ParentForm)this.MdiParent).comport.Open(); // Getting error on this line ((ParentForm)this.MdiParent).comport.Write("send the text on serial Port"); I am getting intellisense for parent's 'comport' in child form. above two sentence in child are write or wrong...? where i'm doing mistake...? Thanks in adavance, Vinay

      T Offline
      T Offline
      Tavbi
      wrote on last edited by
      #2

      Hi, I'm not sure if this is your problem, but I think you don't have defined baud rate, parity, data bits and stop bits for your comport. OR Try send your comport trough parameter to your child form. I hope it helps, Jure

      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