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

Managed C++/CLI

 
Questionrekursif Pin
Achmad Roihan28-Oct-22 3:31
Achmad Roihan28-Oct-22 3:31 
AnswerRe: rekursif Pin
OriginalGriff28-Oct-22 3:38
mveOriginalGriff28-Oct-22 3:38 
Questionrekursif program (Recursive Program) Pin
Achmad Roihan26-Oct-22 20:51
Achmad Roihan26-Oct-22 20:51 
AnswerRe: rekursif program (Recursive Program) Pin
OriginalGriff26-Oct-22 21:02
mveOriginalGriff26-Oct-22 21:02 
QuestionHow to close & clear the oledbconnection on form2()_load? Pin
Paramu19739-Oct-22 15:10
Paramu19739-Oct-22 15:10 
AnswerRe: How to close & clear the oledbconnection on form2()_load? Pin
Gerry Schmitz9-Oct-22 20:32
mveGerry Schmitz9-Oct-22 20:32 
QuestionHow does the compiler achieve the CRT remapping? Pin
John Schroedl22-Aug-22 11:50
professionalJohn Schroedl22-Aug-22 11:50 
Question[Solved] I hope there is a Managed C++/CLR person left to help me with Parallel::For Pin
madusmacus27-Jul-22 5:25
madusmacus27-Jul-22 5:25 
Microsoft Documentation allows me to change the pull down to C++ from C# but continues to shows C# syntax

#pragma once

namespace CppTutorial {

	using namespace System;
  using namespace System::Threading::Tasks;

	/// <summary>
	/// Summary for MainForm
	/// </summary>
	public ref class MainForm : public System::Windows::Forms::Form
	{
	public:
		MainForm(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

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

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
      this->SuspendLayout();
      // 
      // MainForm
      // 
      this->AutoScaleDimensions=System::Drawing::SizeF(6,13);
      this->AutoScaleMode=System::Windows::Forms::AutoScaleMode::Font;
      this->ClientSize=System::Drawing::Size(284,261);
      this->Name=L"MainForm";
      this->Text=L"MainForm";
      this->Shown+=gcnew System::EventHandler(this,&MainForm::MainForm_Shown);
      this->ResumeLayout(false);

    }
#pragma endregion

  public:
  
  static void Body(int index)
  {
    int test=0;
  }

  delegate void MyDelegate(int index);

  System::Void MainForm_Shown(System::Object^ sender,System::EventArgs^ e) 
  {
    MyDelegate ^body=gcnew MyDelegate(MainForm::Body);     
    ParallelLoopResult ^result=Parallel::For(0,10,(System::Action <int> ^)body);
  }

  };
}


I know its all a bit bodged but its the only way i could get it to compile and link but the problem is obvious run time crash
System.InvalidCastException:
Unable to cast object of type 'MyDelegate' to type 'System.Action`1[System.Int32]'.

in MC++/CLI i cant find the right syntax to use for
ParallelLoopResult ^result=Parallel::For( without casting to Action
there is no generic delegate in the overides

Is there any MC++/CLI people left out there that can help or offer any other way to paralleize a for loop

i tried the old parallel_for(x,y,z){ "do stuff here" } way but
i couldnt get that very far with that either
i prefer to stick with .net but this delegate stuff omg :¬( im to old hehe

Thanks for even bothering to read this

modified 28-Jul-22 4:36am.

AnswerRe: I hope there is a Managed C++/CLR person left to help me with Parallel::For Pin
Richard Deeming27-Jul-22 23:13
mveRichard Deeming27-Jul-22 23:13 
General[Final Code Here] Re: I hope there is a Managed C++/CLR person left to help me with Parallel::For Pin
madusmacus27-Jul-22 23:35
madusmacus27-Jul-22 23:35 
Questionc++ forms 2022 code Pin
Member 884846417-Jun-22 2:37
Member 884846417-Jun-22 2:37 
AnswerRe: c++ forms 2022 code Pin
Richard MacCutchan17-Jun-22 4:56
mveRichard MacCutchan17-Jun-22 4:56 
QuestionI want to write a C++/CLI wrapper class library which can be utilized in both C++ and C# applications. Pin
Member 121624009-Jun-22 22:45
Member 121624009-Jun-22 22:45 
Questionsimplifying code Pin
hshan_15-Mar-22 7:30
hshan_15-Mar-22 7:30 
AnswerRe: simplifying code Pin
Victor Nijegorodov15-Mar-22 10:22
Victor Nijegorodov15-Mar-22 10:22 
GeneralRe: simplifying code Pin
Ghazi Warrior22-Mar-22 20:46
Ghazi Warrior22-Mar-22 20:46 
GeneralRe: simplifying code Pin
hshan_19-Apr-22 4:35
hshan_19-Apr-22 4:35 
AnswerRe: simplifying code Pin
Craig Robbins15-Mar-22 10:25
Craig Robbins15-Mar-22 10:25 
QuestionConvert From C# To Visual C++ 2015 Pin
Paramu197313-Dec-21 21:21
Paramu197313-Dec-21 21:21 
Rant[REPOST] Convert From C# To Visual C++ 2015 Pin
Richard Deeming13-Dec-21 22:56
mveRichard Deeming13-Dec-21 22:56 
GeneralRe: [REPOST] Convert From C# To Visual C++ 2015 Pin
Paramu197316-Dec-21 22:14
Paramu197316-Dec-21 22:14 
AnswerRe: Convert From C# To Visual C++ 2015 Pin
Richard MacCutchan13-Dec-21 22:58
mveRichard MacCutchan13-Dec-21 22:58 
GeneralRe: Convert From C# To Visual C++ 2015 Pin
Paramu197316-Dec-21 22:35
Paramu197316-Dec-21 22:35 
AnswerRe: Convert From C# To Visual C++ 2015 Pin
Dave Kreskowiak14-Dec-21 6:05
mveDave Kreskowiak14-Dec-21 6:05 
QuestionopenFileDialog - AccessViolationException was unhandled Pin
Paramu19734-Oct-21 13:28
Paramu19734-Oct-21 13:28 

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.