<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>CodeGuru Forums - Managed C++ and C++/CLI</title>
		<link>http://forums.codeguru.com/</link>
		<description>Discuss Managed C++ and .NET-specific questions related to C++.</description>
		<language>en</language>
		<lastBuildDate>Sun, 19 May 2013 06:41:23 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://forums.codeguru.com/images/misc/rss.png</url>
			<title>CodeGuru Forums - Managed C++ and C++/CLI</title>
			<link>http://forums.codeguru.com/</link>
		</image>
		<item>
			<title><![CDATA[[RESOLVED] Creating Method with parameters]]></title>
			<link>http://forums.codeguru.com/showthread.php?537041-RESOLVED-Creating-Method-with-parameters&amp;goto=newpost</link>
			<pubDate>Thu, 16 May 2013 15:34:14 GMT</pubDate>
			<description><![CDATA[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
---------
]]></description>
			<content:encoded><![CDATA[<div>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.<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><br />
ifndef PROGRESS_BAR<br />
define PROGRESS_BAR<br />
<br />
<br />
<br />
class Progress_bar{<br />
<br />
public:<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  void set_Progress(ToolStripProgressBar^ progress_bar,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ToolStripStatusLabel^ label,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Timer^ time){<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  toolStripProgressBar1 = progress_bar;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  toolStripStatusLabel1 = label;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  timer1 = time;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // Increment the value of the ProgressBar a value of one each time.<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this-&gt;toolStripProgressBar1-&gt;Increment(10);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Display the textual value of the ProgressBar in the StatusBar control's first panel.<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; toolStripStatusLabel1-&gt;Text = String::Concat( toolStripProgressBar1-&gt;Value, &quot;% Loading&quot; );<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( toolStripProgressBar1-&gt;Value == toolStripProgressBar1-&gt;Maximum ){<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // Stop the timer.<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; toolStripStatusLabel1-&gt;Text = &quot;Completed&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer1-&gt;Stop(); <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  private: System::Windows::Forms::ToolStripProgressBar^&nbsp; toolStripProgressBar1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System::Windows::Forms::ToolStripStatusLabel^&nbsp; toolStripStatusLabel1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System::Windows::Forms::Timer^&nbsp; timer1;<br />
<br />
<br />
};<br />
<br />
<br />
# endif</code><hr />
</div> <div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><br />
the way that i´m calling this method on Form1.h<br />
<br />
void set_Progress( toolStripProgressBar1, toolStripStatusLabel1 ,timer1);</code><hr />
</div> errors:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><br />
Error&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; &nbsp; &nbsp; error C2182: 'set_Progress' : illegal use of type 'void'&nbsp; &nbsp; &nbsp; &nbsp; h:\cry_dev\programming\c++\school_media\school_media\Form1.h&nbsp; &nbsp; &nbsp; &nbsp; 277<br />
Error&nbsp; &nbsp; &nbsp; &nbsp; 2&nbsp; &nbsp; &nbsp; &nbsp; error C2078: too many initializers&nbsp; &nbsp; &nbsp; &nbsp; h:\cry_dev\programming\c++\school_media\school_media\Form1.h&nbsp; &nbsp; &nbsp; &nbsp; 277<br />
Error&nbsp; &nbsp; &nbsp; &nbsp; 3&nbsp; &nbsp; &nbsp; &nbsp; error C2440: 'initializing' : cannot convert from 'System::Windows::Forms::Timer ^' to 'int'&nbsp; &nbsp; &nbsp; &nbsp; h:\cry_dev\programming\c++\school_media\school_media\Form1.h&nbsp; &nbsp; &nbsp; &nbsp; 277</code><hr />
</div> </div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?17-Managed-C-and-C-CLI">Managed C++ and C++/CLI</category>
			<dc:creator>crisdeveloper</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?537041-RESOLVED-Creating-Method-with-parameters</guid>
		</item>
	</channel>
</rss>
