0
저는 C++과 Im의 새로운 VS2010입니다. 누군가 아래 코드를 확인하고 해결할 수 있습니까? UpdateDataGrid(unsigned char CANPacket[15])
함수가 호출 될 때마다 다음 메시지가 새 창에 표시되고 응용 프로그램이 닫힙니다.VS C++ InvokeRequired/delegate 관련 문제 void
An unhandled exception of type 'System.ArgumentException' occurred in System.Windows.Forms.dll
Additional information: Object of type 'System.Byte' cannot be converted to type 'System.Byte*'.
나는 unsinged char
데이터 형식을 사용할 필요하지 String^
이 프로젝트이다. 내 코드를 수정할 방법이 있습니까?
//Piece of my code
namespace VCCDC {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Threading;
public ref class Form1 : public System::Windows::Forms::Form
{
delegate void UpdateDataGridCallback(unsigned char CanPacket[15]);
private: void UpdateDataGrid(unsigned char CANPacket[15]) {
if (this->dataGridView1->InvokeRequired) {
UpdateDataGridCallback^ d = gcnew UpdateDataGridCallback(this,&VCCDC::Form1::UpdateDataGrid);
this->Invoke(d,gcnew unsigned char(CANPacket[15]));
}
else {
//Update dataGridView1 with new data
}
}
}
}]