Return Value in Function



#pragma once

namespace My54 {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
///
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
///

public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
///
/// Clean up any resources being used.
///

~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ BtnReturn;
private: System::Windows::Forms::Label^ lblReturnValue;
protected:
protected:
private:
///
/// Required designer variable.
///

System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

void InitializeComponent(void)
{
this->BtnReturn = (gcnew System::Windows::Forms::Button());
this->lblReturnValue = (gcnew System::Windows::Forms::Label());
this->SuspendLayout();
//
// BtnReturn
//
this->BtnReturn->BackColor = System::Drawing::Color::FromArgb(static_cast
(static_cast(64)), static_cast(static_cast(0)),
static_cast
(static_cast(64)));
this->BtnReturn->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast
(222)));
this->BtnReturn->ForeColor = System::Drawing::Color::White;
this->BtnReturn->Location = System::Drawing::Point(12, 66);
this->BtnReturn->Name = L"BtnReturn";
this->BtnReturn->Size = System::Drawing::Size(268, 63);
this->BtnReturn->TabIndex = 0;
this->BtnReturn->Text = L"Return Value";
this->BtnReturn->UseVisualStyleBackColor = false;
this->BtnReturn->Click += gcnew System::EventHandler(this, &Form1::BtnReturn_Click);
//
// lblReturnValue
//
this->lblReturnValue->AutoSize = true;
this->lblReturnValue->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast
(222)));
this->lblReturnValue->ForeColor = System::Drawing::Color::Yellow;
this->lblReturnValue->Location = System::Drawing::Point(12, 25);
this->lblReturnValue->Name = L"lblReturnValue";
this->lblReturnValue->Size = System::Drawing::Size(114, 18);
this->lblReturnValue->TabIndex = 2;
this->lblReturnValue->Text = L"Return Value :";
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->BackColor = System::Drawing::SystemColors::ControlDark;
this->ClientSize = System::Drawing::Size(292, 142);
this->Controls->Add(this->lblReturnValue);
this->Controls->Add(this->BtnReturn);
this->Name = L"Form1";
this->Text = L"Return Value In Function";
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
//Return Value in Function
int Ch_X;
int MoveX(int Step)
{
Ch_X+=Step;
return Ch_X;
}
private: System::Void BtnReturn_Click(System::Object^ sender, System::EventArgs^ e) {
lblReturnValue->Text="Return Value : "+MoveX(2);
}
};
}