Click here to Skip to main content
15,513,762 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: Serial Port BytesToRead always 0 Pin
Richard MacCutchan21-May-21 2:38
mveRichard MacCutchan21-May-21 2:38 
GeneralRe: Serial Port BytesToRead always 0 Pin
cibec75455@frnla.com21-May-21 2:47
cibec75455@frnla.com21-May-21 2:47 
QuestionHow to call System::Windows::Forms::Controls "invoke" method? Pin
Member 1515077819-May-21 20:48
Member 1515077819-May-21 20:48 
I made a class myGroupbox to use SerialPort, and I'm trying to update a textbox from the serial port data. But the invoke function couldn't be used, the error message is "myGroupbox has no member invoke"

here's my code


myGroupbox.h
#pragma once
using namespace System::Windows::Forms;
ref class myGroupbox
{
    private: System::IO::Ports::SerialPort^ _serialPort;
    
    public:
    myGroupbox( System::IO::Ports::SerialPort^ serialPort )
    {
    _serialPort=serialPort;
    
            _serialPort->DataReceived += gcnew System::IO::Ports::SerialDataReceivedEventHandler(this, &myGroupbox::SerialPort_DataReceived);
    }
    
  private: 	System::Void SerialPort_DataReceived(System::Object^ sender,System::IO::Ports::SerialDataReceivedEventArgs^ e)
    {
        uint16_t test = 0;

        test = _serialPort->BytesToRead;

        if (test == 3U) {



            this->Invoke(gcnew EventHandler(this, &myGroupbox::ProcessReceived)); // ERROR in this line, Invoke not found
        }
        else
        {
            _serialPort->DiscardInBuffer();
        }
    }

    private: System::Void ProcessReceived(System::Object^ sender, System::EventArgs^ e)
    {

        //set textbox text

    }

}

AnswerRe: How to call System::Windows::Forms::Controls "invoke" method? Pin
Victor Nijegorodov19-May-21 21:28
Victor Nijegorodov19-May-21 21:28 
GeneralRe: How to call System::Windows::Forms::Controls "invoke" method? Pin
Member 1515077819-May-21 21:35
Member 1515077819-May-21 21:35 
GeneralRe: How to call System::Windows::Forms::Controls "invoke" method? Pin
Richard MacCutchan19-May-21 22:09
mveRichard MacCutchan19-May-21 22:09 
GeneralRe: How to call System::Windows::Forms::Controls "invoke" method? Pin
Member 1515077819-May-21 22:20
Member 1515077819-May-21 22:20 
QuestionWhat is a preferable approach to develop a common class that handles multiple identical groupbox? Pin
Member 1515077818-May-21 1:41
Member 1515077818-May-21 1:41 
QuestionHow to convert array<System::Byte^>^ to array<unsigned char>^ Pin
Member 1515077812-May-21 19:19
Member 1515077812-May-21 19:19 
QuestionRe: How to convert array<System::Byte^>^ to array<unsigned char>^ Pin
Richard MacCutchan12-May-21 22:05
mveRichard MacCutchan12-May-21 22:05 
AnswerRe: How to convert array<System::Byte^>^ to array<unsigned char>^ Pin
Member 1515077817-May-21 1:06
Member 1515077817-May-21 1:06 
QuestionHow to implement a global variable if C++/CLI doesn't support it at all? Pin
Member 1515077812-May-21 0:29
Member 1515077812-May-21 0:29 
AnswerRe: How to implement a global variable if C++/CLI doesn't support it at all? Pin
Richard MacCutchan12-May-21 0:47
mveRichard MacCutchan12-May-21 0:47 
GeneralRe: How to implement a global variable if C++/CLI doesn't support it at all? Pin
Member 1515077812-May-21 19:30
Member 1515077812-May-21 19:30 
Questioncpp Pin
likith adithya22-Feb-21 0:39
likith adithya22-Feb-21 0:39 
QuestionRe: cpp Pin
Richard MacCutchan22-Feb-21 0:40
mveRichard MacCutchan22-Feb-21 0:40 
AnswerRe: cpp Pin
Richard Deeming22-Feb-21 1:34
mveRichard Deeming22-Feb-21 1:34 
QuestionSee if print queue is empty Pin
Erich Ruth17-Feb-21 7:25
Erich Ruth17-Feb-21 7:25 
AnswerRe: See if print queue is empty Pin
Richard MacCutchan17-Feb-21 22:29
mveRichard MacCutchan17-Feb-21 22:29 
QuestionCompiling a shared library Pin
Member 1504770716-Jan-21 6:57
Member 1504770716-Jan-21 6:57 
AnswerRe: Compiling a shared library Pin
Gerry Schmitz17-Jan-21 4:09
mveGerry Schmitz17-Jan-21 4:09 
GeneralRe: Compiling a shared library Pin
Member 1504770718-Jan-21 4:52
Member 1504770718-Jan-21 4:52 
GeneralRe: Compiling a shared library Pin
Gerry Schmitz18-Jan-21 6:40
mveGerry Schmitz18-Jan-21 6:40 
Question.NET 5? Pin
John Schroedl5-Jan-21 5:13
professionalJohn Schroedl5-Jan-21 5:13 
AnswerRe: .NET 5? Pin
Richard Andrew x6418-Jan-21 13:03
professionalRichard Andrew x6418-Jan-21 13:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.