[RESOLVED] Windows Form - Create Method with parameters
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: [RESOLVED] Windows Form - Create Method with parameters

  1. #1
    Join Date
    May 2013
    Location
    // Brazil
    Posts
    51

    [RESOLVED] Windows Form - Create Method with parameters

    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(ToolStripStatusLabel^ label,Timer^ time){
    
    
    		   toolStripProgressBar1 = 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;
               private: System::Windows::Forms::Timer^  timer1;
    
    
    };
    
    
    # endif
    Code:
    the way that im calling this method on Form1.h
    
    void set_Progress(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:31 AM.

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    5,875

    Re: Windows Form - Create Method with parameters

    This is not c++. This is managed c++ which is different. You should post this in the managed c++ forum.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2017 (15.5.0)

  3. #3
    Join Date
    May 2013
    Location
    // Brazil
    Posts
    51

    Re: Windows Form - Create Method with parameters

    thanks for advice me. this thread will be close or something like this?

  4. #4
    Join Date
    May 2013
    Location
    // Brazil
    Posts
    51

    Re: [RESOLVED] Windows Form - Create Method with parameters


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)