Hi
I’m trying to pass a handle to a serial port class to a form that will configure the serial port.
I can pass a handle to the constructor and it works fine/as I expect inside the constructor but I need a local copy of the handle that points to the port I can use after the constructor is finished by combobox events.
I can declare a local serial port class var.
I can copy of the original serial port’s class data but I want a handle to the original not a copy of its data.

public ref class Config_Serial_Port_Form : public System::Windows::Forms::Form
{
public:
Config_Serial_Port_Form(System::IO::Ports::SerialPort^% initport)
{
initport->BaudRate = 600; //this accesses the correct port
theport = initport; //this only copies all the original to the local object
//I need theport to be a pointer
InitializeComponent();
//
//TODO: Add the constructor code here
//
}

void domystuff(void)
{
port_stuff^ port_stuff_ptr;
port_stuff_ptr = gcnew port_stuff();
this->Baud_Rate_comboBox->Text = port_stuff_ptr->BaudRate_to_string(theport);
this->Parity_comboBox->Text = port_stuff_ptr->Parity_to_string(theport);
this->handshakingcomboBox->Text = port_stuff_ptr->Handshake_to_string(theport);
this->databitscomboBox->Text = port_stuff_ptr->DataBits_to_string(theport);
if (theport->IsOpen)
this->portselectcomboBox->Text = theport->PortName;
this->portselectcomboBox->Items->AddRange(theport->GetPortNames());
this->portselectcomboBox->Items->Add("COM4");

}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Config_Serial_Port_Form()
{
if (components)
{
delete components;
}
}

private: System::IO::Ports::SerialPort^ theport; /// this gives me a second object not a handle to the original.