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

Managed C++/CLI

 
GeneralRe: How to call System::Windows::Forms::Controls "invoke" method? Pin
Member 1515077819-May-21 20:35
Member 1515077819-May-21 20:35 
GeneralRe: How to call System::Windows::Forms::Controls "invoke" method? Pin
Richard MacCutchan19-May-21 21:09
mveRichard MacCutchan19-May-21 21:09 
GeneralRe: How to call System::Windows::Forms::Controls "invoke" method? Pin
Member 1515077819-May-21 21:20
Member 1515077819-May-21 21:20 
QuestionWhat is a preferable approach to develop a common class that handles multiple identical groupbox? Pin
Member 1515077818-May-21 0:41
Member 1515077818-May-21 0:41 
QuestionHow to convert array<System::Byte^>^ to array<unsigned char>^ Pin
Member 1515077812-May-21 18:19
Member 1515077812-May-21 18:19 
QuestionRe: How to convert array<System::Byte^>^ to array<unsigned char>^ Pin
Richard MacCutchan12-May-21 21:05
mveRichard MacCutchan12-May-21 21:05 
AnswerRe: How to convert array<System::Byte^>^ to array<unsigned char>^ Pin
Member 1515077817-May-21 0:06
Member 1515077817-May-21 0:06 
QuestionHow to implement a global variable if C++/CLI doesn't support it at all? Pin
Member 1515077811-May-21 23:29
Member 1515077811-May-21 23:29 
I'm trying to build a really simple class with member variables and member functions for learning.

I am trying to achieve the following code inside btn_User1_Click, however since user1 is not globally declared, it couldn't find the variable. At the same time, if I tried to declare this
myUser^ user1 = gcnew user1 (1002); outside the function , it gives an error syntax error missing ';' before '^'

myUser.h
#pragma once
ref class myUser
{

public: 
    myUser(unsigned int user_id) :id(user_id) {

...

	}


private:
    unsigned int id{ 0 };



public:

	System::Void increment_UserID() {

  id = id + 1;

	}
};


MyForm.cpp


namespace FACEDControllerGUI {

	System::Void MyForm::MyForm_Load(System::Object^ sender, System::EventArgs^ e) {

        myUser^ user1 = gcnew user1 (1002);
        myUser^ user2 = gcnew user1 (1005);

    }

	System::Void MyForm::btn_User1_Click(System::Object^ sender, System::EventArgs^ e) {
		user1->increment_UserID();
	}
	
	System::Void MyForm::btn_User2_Click(System::Object^ sender, System::EventArgs^ e) {
		user2->increment_UserID();
	}


} // end namespace

AnswerRe: How to implement a global variable if C++/CLI doesn't support it at all? Pin
Richard MacCutchan11-May-21 23:47
mveRichard MacCutchan11-May-21 23:47 
GeneralRe: How to implement a global variable if C++/CLI doesn't support it at all? Pin
Member 1515077812-May-21 18:30
Member 1515077812-May-21 18:30 
Questioncpp Pin
likith adithya21-Feb-21 23:39
likith adithya21-Feb-21 23:39 
QuestionRe: cpp Pin
Richard MacCutchan21-Feb-21 23:40
mveRichard MacCutchan21-Feb-21 23:40 
AnswerRe: cpp Pin
Richard Deeming22-Feb-21 0:34
mveRichard Deeming22-Feb-21 0:34 
QuestionSee if print queue is empty Pin
Erich Ruth17-Feb-21 6:25
Erich Ruth17-Feb-21 6:25 
AnswerRe: See if print queue is empty Pin
Richard MacCutchan17-Feb-21 21:29
mveRichard MacCutchan17-Feb-21 21:29 
QuestionCompiling a shared library Pin
Member 1504770716-Jan-21 5:57
Member 1504770716-Jan-21 5:57 
AnswerRe: Compiling a shared library Pin
Gerry Schmitz17-Jan-21 3:09
mveGerry Schmitz17-Jan-21 3:09 
GeneralRe: Compiling a shared library Pin
Member 1504770718-Jan-21 3:52
Member 1504770718-Jan-21 3:52 
GeneralRe: Compiling a shared library Pin
Gerry Schmitz18-Jan-21 5:40
mveGerry Schmitz18-Jan-21 5:40 
Question.NET 5? Pin
John Schroedl5-Jan-21 4:13
professionalJohn Schroedl5-Jan-21 4:13 
AnswerRe: .NET 5? Pin
Richard Andrew x6418-Jan-21 12:03
professionalRichard Andrew x6418-Jan-21 12:03 
GeneralRe: .NET 5? Pin
John Schroedl19-Jan-21 2:39
professionalJohn Schroedl19-Jan-21 2:39 
GeneralRe: .NET 5? Pin
Doug Milne 202111-Aug-21 5:06
Doug Milne 202111-Aug-21 5:06 
GeneralRe: .NET 5? Pin
John Schroedl11-Aug-21 5:25
professionalJohn Schroedl11-Aug-21 5:25 
GeneralRe: .NET 5? Pin
Doug Milne 202111-Aug-21 7:45
Doug Milne 202111-Aug-21 7:45 

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.