I am wanting to separate the logic from the visual, but I'm having problems when calling the method that controls the actions of the progress bar timer.
Code:
ifndef PROGRESS_BAR
define PROGRESS_BAR
class Progress_bar{
public:
void set_Progress(ToolStripProgressBar^ progress_bar,
ToolStripStatusLabel^ label,
Timer^ time){
toolStripProgressBar1 = progress_bar;
toolStripStatusLabel1 = label;
timer1 = time;
// Increment the value of the ProgressBar a value of one each time.
this->toolStripProgressBar1->Increment(10);
// Display the textual value of the ProgressBar in the StatusBar control's first panel.
toolStripStatusLabel1->Text = String::Concat( toolStripProgressBar1->Value, "% Loading" );
if ( toolStripProgressBar1->Value == toolStripProgressBar1->Maximum ){
// Stop the timer.
toolStripStatusLabel1->Text = "Completed";
timer1->Stop();
}
}
private: System::Windows::Forms::ToolStripProgressBar^ toolStripProgressBar1;
System::Windows::Forms::ToolStripStatusLabel^ toolStripStatusLabel1;
System::Windows::Forms::Timer^ timer1;
};
# endif
Code:
the way that i´m calling this method on Form1.h
void set_Progress( toolStripProgressBar1, toolStripStatusLabel1 ,timer1);
errors:
Code:
Error 1 error C2182: 'set_Progress' : illegal use of type 'void' h:\cry_dev\programming\c++\school_media\school_media\Form1.h 277
Error 2 error C2078: too many initializers h:\cry_dev\programming\c++\school_media\school_media\Form1.h 277
Error 3 error C2440: 'initializing' : cannot convert from 'System::Windows::Forms::Timer ^' to 'int' h:\cry_dev\programming\c++\school_media\school_media\Form1.h 277
Last edited by crisdeveloper; May 16th, 2013 at 11:27 AM.
class Progress_bar{
public:
void set_Progress(System::Windows::Forms::ToolStripProgressBar^ ProgressBar1,
System::Windows::Forms::ToolStripStatusLabel^ LabelBar1,
System::Windows::Forms::Timer^ timer1)
{
ProgressBar1 = ProgressBar1;
LabelBar1 = LabelBar1;
timer1 = timer1;
// Increment the value of the ProgressBar a value of one each time.
ProgressBar1->Increment(10);
// Display the textual value of the ProgressBar in the StatusBar control's first panel.
LabelBar1->Text = System::String::Concat( ProgressBar1->Value, "% Loading" );
if ( ProgressBar1->Value == ProgressBar1->Maximum ){
// Stop the timer.
LabelBar1->Text = "Completed";
timer1->Stop();
}
}
private:
System::Windows::Forms::ToolStripProgressBar^ ProgressBar1;
System::Windows::Forms::ToolStripStatusLabel^ LabelBar1;
System::Windows::Forms::Timer^ timer1;
};
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ProgressBar p;
p.set_Progress(ProgressBar1,LabelBar1 ,timer1);
Last edited by crisdeveloper; May 16th, 2013 at 12:24 PM.
Error 1 error C3265: cannot declare a managed 'ProgressBar1' in an unmanaged 'Progress_bar'
Error 2 error C3265: cannot declare a managed 'LabelBar1' in an unmanaged 'Progress_bar'
Error 3 error C3265: cannot declare a managed 'timer1' in an unmanaged 'Progress_bar'
Bookmarks