Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4344974
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:58:22+00:00 2026-05-21T11:58:22+00:00

I added a serial port com1 to my vb.net form. I created a new

  • 0

I added a serial port com1 to my vb.net form. I created a new class and wrote a method to open the com1 and created its object in the main form and called the method and its opening.

THen i created another class wrote a method to write data to the com and same way created an object and called it but i am getting the error as port is closed. What am i doing wrong.

To open the port

public class openport
public sub opencom
mainform.com1.open
end sub
end class

//in the mian form

dim cc as openport

cc.opencom

‘The above stuff works

But when i do same thing in another class for writing using

mainform.com1.write(data)

i am getting an error as port closed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T11:58:22+00:00Added an answer on May 21, 2026 at 11:58 am

    It looks like you are defining one comport, then opening a different one. Check that, if you still have issues post your complete code.

    'Form1
    public SP as SerialPort;
    ' Form1 Load Event
    SP = New SerialPort("COM##", ...)
    ' Form1 Loads New Form
    dim newForm as New Form2()
    newForm.OldForm = Me
    newForm.Show();
    
    'Form2
    public OldForm as Form1
    'Form2 Minipulate COM port
    OldForm.SP.Write(data) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a serial application that I parallelized using OpenMP. I simply added the
Added : I am conducting a study for a new system we're going to
I added some custom fields (public booleans) to the global class in global.asax.cs which
So I have this test code to send HELLO over a USB serial port:
I wrote a simple Tkinter based Python application that reads text from a serial
I am new to COM and need to add a Server COM object to
I am interfacing with a USB-to-serial port that can be inserted or removed at
I added the below dependencies in my project POM file and the SerialAddress class
I wrote the following code for a Link list to create a Book its
I have a very large database (with new information being added everyday) that a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.