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. Managed C++/CLI
  4. How to make Serial Port static from the designer?

How to make Serial Port static from the designer?

Scheduled Pinned Locked Moved Managed C++/CLI
designtutorialquestion
4 Posts 2 Posters 11 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.
  • Y Offline
    Y Offline
    yehiga1467
    wrote on last edited by
    #1

    Hello all, my code requires the Serial Port to be static. Each time I make changes to the UI, I have to manually set the Serial Port to static. like this

    private: System::IO::Ports::SerialPort^ mySerialPort;

    to this

    private: static System::IO::Ports::SerialPort^ mySerialPort;

    Is there a way to automatically be static?

    L 1 Reply Last reply
    0
    • Y yehiga1467

      Hello all, my code requires the Serial Port to be static. Each time I make changes to the UI, I have to manually set the Serial Port to static. like this

      private: System::IO::Ports::SerialPort^ mySerialPort;

      to this

      private: static System::IO::Ports::SerialPort^ mySerialPort;

      Is there a way to automatically be static?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Add it to your class manually rather than in the designer.

      Y 1 Reply Last reply
      0
      • L Lost User

        Add it to your class manually rather than in the designer.

        Y Offline
        Y Offline
        yehiga1467
        wrote on last edited by
        #3

        Thanks I have been adding the static keyword manually. But do you know if there is a way to automatically do this?

        L 1 Reply Last reply
        0
        • Y yehiga1467

          Thanks I have been adding the static keyword manually. But do you know if there is a way to automatically do this?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          I have never tried, but I would not expect so. If you drag a control onto a form in the designer then the designer adds it to the Form's properties. But there is nothing (at least in C# Forms) that I can see that allows you to modify it to be static.

          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