Witam, mam mały problem z modyfikacją zmiennych z innego pliku.
Chodzi mi oto aby z pliku funkcja.h była możliwość modyfikowania zmiennej ProgressBaru
this->progressBar1->Value = 100;
Kod Programu
Form1
#pragma once
#include "funkcja.h"
namespace T1 {
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>
/// Summary for Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
public: System::Windows::Forms::ProgressBar^ progressBar1;
protected:
protected:
private: System::Windows::Forms::Button^ OK;
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->progressBar1 = (gcnew System::Windows::Forms::ProgressBar());
this->OK = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// progressBar1
//
this->progressBar1->Location = System::Drawing::Point(68, 71);
this->progressBar1->Name = L"progressBar1";
this->progressBar1->Size = System::Drawing::Size(367, 30);
this->progressBar1->TabIndex = 0;
this->progressBar1->Value = 1;
//
// OK
//
this->OK->Location = System::Drawing::Point(191, 148);
this->OK->Name = L"OK";
this->OK->Size = System::Drawing::Size(124, 21);
this->OK->TabIndex = 1;
this->OK->Text = L"OK";
this->OK->UseVisualStyleBackColor = true;
this->OK->Click += gcnew System::EventHandler(this, &Form1::OK_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(500, 197);
this->Controls->Add(this->OK);
this->Controls->Add(this->progressBar1);
this->Name = L"Form1";
this->Text = L"Program";
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void OK_Click(System::Object^ sender, System::EventArgs^ e)
{
Check(1);
}
};
}
funkcja.h
int Check(int a)
{
if(a == 1)
{
Form1->progressBar1->Value = 100;
return 1;
}
return 0;
}
Oczywiście zmienne progressbaru są na typie public:
Gdzie popełniłem błąd?
Proszę o pomoc.