Solved

Definition of "global" variable

Posted on 2011-03-11
7
502 Views
Last Modified: 2012-05-11
I have attached a code snippet with 4 functions:

- SetButtonText

- Kamp1H_Click
- Kamp1U_Click
- Kamp1B_Click

When I click on one of the buttons Kamp1H, Kamp1U or Kamp1B the program transfers control to the SetButtonText and sets the Text property of the actual button to "X". (An "X" is shown as text on the button). All this code resides in the Form2.h-file.

I want to define a variable of type int which has 12 elements. The variable is called "Dekning". (int Dekning[11];), and I want this variable to be directly accessible from all the functions SetButtonText, Kamp1H_Click, Kamp1U_Click and Kamp1B_Click. How can I achieve this ?
Where and how should I define it, in the Form2.h-file or Form2.ccp-file ? And how will the syntax be ?
I'm a newbie on Visual C++, and I'm using Visual Studio .NET 2003.
 

private: System::Void SetButtonText(System::Windows::Forms::Button* clickedButton) {
         	 
		 clickedButton->Text = "X";
}
private: System::Void Kamp1H_Click(System::Object*  sender, System::EventArgs*  e) {
	SetButtonText(this->Kamp1H);  // Call common function
}
private: System::Void Kamp1U_Click(System::Object*  sender, System::EventArgs*  e) {		
	SetButtonText(this->Kamp1U);  // Call common function
}

private: System::Void Kamp1B_Click(System::Object *  sender, System::EventArgs *  e)
		 {
	SetButtonText(this->Kamp1B);  // Call common function
		 }

Open in new window

0
Comment
Question by:toyboy61
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 150 total points
ID: 35112235
You'll have to declare it outside of each of those functions and before any of those functions if you want it to be accessible. If you were to define it in the .cpp file, it would most likely not be accessible in the .h file since it would be expected that the .h be included in the .cpp file and this inclusion would probably happen before the variables actual declaration.

If you scroll up in your .h file, you should see private global variables for each of the buttons you declared on your form. You can follow that example to declare you global. Note, these variables are global to the form (class), and not the entire application. By OO programming standards, you'll typically have class-global variables marked as private. Your design will dictate the need to alter this, though.
0
 
LVL 16

Assisted Solution

by:HooKooDooKu
HooKooDooKu earned 100 total points
ID: 35114739
Create a file "global.h" and declare all your global variables there:

{global.h}
extern int Dekning[11];

Then create a global.cpp file to define the global variables:

{global.cpp}
#include "global.h"
int Dekning[11];

Simply #include "global.h" in any cpp file that you want to have access to the global variables.
Then, any cpp file that you want to have access to the global variables, just #include "global.h" at the top of the cpp file.

Basically, he extern key word in the .h file means "I'm declaring this variable exists, but it is defined somewhere else".  Then, the line in the .cpp file actually defines the variable.
0
 

Author Comment

by:toyboy61
ID: 35115603
I'm wondering about the following: When I create a form in Visual Studio .NET 2003 (Visual C++) the code for the form and other elements are defined in the "FormX.h"-file and no code is generated in the FormX.cpp-file. But the file "FormX.h" is included in the FormX.cpp and not the other way...

Should I consider the definitions in the "FormX.h"-file as prototypes(?) , and put my executable code in the "FormX.cpp" or maybe it doesn't matter at all ?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:toyboy61
ID: 35115676
HooKooDooKu: I tried your solution, but even if I include "globals.h" at the top of the "Form2.cpp"-file I get an error message when trying to build the program telling me that "Dekning" is an undeclared  identifier.. The next error messages tells me that " 'Dekning': identifier not found, even with argument-dependent lookup".

kaufmed: Your solution worked as it should, even though I had to struggle a bit with __gc and __nogc-definitions...

 
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 35115701
>>  Should I consider the definitions in the "FormX.h"-file as prototypes(?) , and put my executable code in the "FormX.cpp" or maybe it doesn't matter at all ?

When learning C/C++, I was always told that the .h file was for things you wanted other developers who might use your class/code to know about (function names, variables, etc). With the .NET version, I got the impression that MS was disregarding this as I seem to recall seeing executable code in the .h file. I want to say it comes down to personal preference.

That said, I hope your aware that all that is occurring when you say "#include X" is that the entire contents of X are being inserted textually into the file it is being included in. C/C++ are "declare before use" languages--I believe even with the .NET version. When you declare something in the .h file, and you include that .h file in some other file, the .cpp file for example, the preprocessor inserts a copy of the .h file into the target file before the compiler processes the code. As long as the variable or function you want to use is declared before it is used (i.e. it is declared in the .h file, and the #include statement falls lexically before the actual use of such), then you should not have a problem accessing such things.
0
 

Author Comment

by:toyboy61
ID: 35116767
kaufmed: Thanks for your comment. It was very helpful to me. I also got the impression that the .h-files should be used for definitions (function names, variables, classes etc), and that the .cpp-files would contain executable code.

To make this even more complicated I found the following in the ReadMe.txt-file accompanying my project in VS:
"
Form1.cpp
    This is the main application source file.
    Contains the code to display the form.

Form1.h
    Contains the implementation of your form class and InitializeComponent() function. "

So the Form1.cpp contains the code to display the form(!), and Form1.h contains the implementation of your form class etc. From this I read that the executable code should be placed in the Form1.cpp-file. But as you said: It's a matter of personal preference..

I must investigate further to find out why my variable is not accessible. There must be a logical solution to this somewhere... :-)
0
 

Author Comment

by:toyboy61
ID: 35123458
HooKooDooKu:
In the attached code snippet I have put the code which is used in the following files:
- global.h
- global.cpp
- Form1.cpp
- Form1.h

When I try to compile and build this project I get the following errors:
"Form1.cpp(25) : error C2065: 'Dekning' : undeclared identifier" even though the variable "Dekning" is defined in the file "global.h" as extern, and it is also referenced in the "global.cpp"-file.

Both the "global.h"-file and the "global.cpp"-file are stored in the same directories as the other .h and .cpp-files for the project.

I do not understand why I get this error... Anyone ?
[global.h]
extern int Dekning[11];

[global.cpp]
int Dekning[11];

[Form1.cpp]
#include "global.h"
#include "stdafx.h"
#include "Form1.h"
#include <windows.h>

using namespace Systemtipp2011;

int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{
	System::Threading::Thread::CurrentThread->ApartmentState = System::Threading::ApartmentState::STA;
	Application::Run(new Form1());
	return 0;
}

static String* GetFiles( String* path )  __gc[];

System::Void button1_Click(System::Object *  sender, System::EventArgs *  e)
		 {
			 Dekning[1] = 7; 	
		 }


[Form1.h]
#pragma once

namespace Systemtipp2011
{
	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
	///
	/// 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.
	/// </summary>

	public __gc class Form1 : public System::Windows::Forms::Form
	{	
	public:
		Form1(void)
		{
			InitializeComponent();			
		}
  
	protected:
		void Dispose(Boolean disposing)
		{
			if (disposing && components)
			{
				components->Dispose();
			}
			__super::Dispose(disposing);
		}
	private: System::Windows::Forms::Button *  button1;
	private: System::Windows::Forms::Button *  button2;
	private: System::Windows::Forms::Button *  button3;
	private: System::Windows::Forms::Button *  Kamp12B;
	private: System::Windows::Forms::Button *  Kamp12U;
	private: System::Windows::Forms::Button *  Kamp12H;
	private: System::Windows::Forms::Button *  Kamp11B;
	private: System::Windows::Forms::Button *  Kamp11U;
	private: System::Windows::Forms::Button *  Kamp11H;
	private: System::Windows::Forms::Button *  Kamp10B;
	private: System::Windows::Forms::Button *  Kamp10U;
	private: System::Windows::Forms::Button *  Kamp10H;
	private: System::Windows::Forms::Button *  Kamp9B;
	private: System::Windows::Forms::Button *  Kamp9U;
	private: System::Windows::Forms::Button *  Kamp9H;
	private: System::Windows::Forms::Button *  Kamp8B;
	private: System::Windows::Forms::Button *  Kamp8U;
	private: System::Windows::Forms::Button *  Kamp8H;
	private: System::Windows::Forms::Button *  Kamp7B;
	private: System::Windows::Forms::Button *  Kamp7U;
	private: System::Windows::Forms::Button *  Kamp7H;
	private: System::Windows::Forms::Button *  Kamp6B;
	private: System::Windows::Forms::Button *  Kamp6U;
	private: System::Windows::Forms::Button *  Kamp6H;
	private: System::Windows::Forms::Button *  Kamp5B;
	private: System::Windows::Forms::Button *  Kamp5U;
	private: System::Windows::Forms::Button *  Kamp5H;
	private: System::Windows::Forms::Button *  Kamp4B;
	private: System::Windows::Forms::Button *  Kamp4U;
	private: System::Windows::Forms::Button *  Kamp4H;
	private: System::Windows::Forms::Button *  Kamp3B;
	private: System::Windows::Forms::Button *  Kamp3U;
	private: System::Windows::Forms::Button *  Kamp3H;
	private: System::Windows::Forms::Button *  Kamp2B;
	private: System::Windows::Forms::Button *  Kamp2U;
	private: System::Windows::Forms::Button *  Kamp2H;
	private: System::Windows::Forms::TextBox *  textBox12;
	private: System::Windows::Forms::TextBox *  textBox11;
	private: System::Windows::Forms::TextBox *  textBox10;
	private: System::Windows::Forms::TextBox *  textBox9;
	private: System::Windows::Forms::TextBox *  textBox8;
	private: System::Windows::Forms::TextBox *  textBox7;
	private: System::Windows::Forms::TextBox *  textBox6;
	private: System::Windows::Forms::TextBox *  textBox5;
	private: System::Windows::Forms::TextBox *  textBox4;
	private: System::Windows::Forms::TextBox *  textBox3;
	private: System::Windows::Forms::TextBox *  textBox2;
	private: System::Windows::Forms::Button *  Kamp1B;
	private: System::Windows::Forms::Button *  Kamp1U;
	private: System::Windows::Forms::Button *  Kamp1H;
	private: System::Windows::Forms::TextBox *  textBox1;



	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container * components;

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->button1 = new System::Windows::Forms::Button();
			this->button2 = new System::Windows::Forms::Button();
			this->button3 = new System::Windows::Forms::Button();
			this->Kamp12B = new System::Windows::Forms::Button();
			this->Kamp12U = new System::Windows::Forms::Button();
			this->Kamp12H = new System::Windows::Forms::Button();
			this->Kamp11B = new System::Windows::Forms::Button();
			this->Kamp11U = new System::Windows::Forms::Button();
			this->Kamp11H = new System::Windows::Forms::Button();
			this->Kamp10B = new System::Windows::Forms::Button();
			this->Kamp10U = new System::Windows::Forms::Button();
			this->Kamp10H = new System::Windows::Forms::Button();
			this->Kamp9B = new System::Windows::Forms::Button();
			this->Kamp9U = new System::Windows::Forms::Button();
			this->Kamp9H = new System::Windows::Forms::Button();
			this->Kamp8B = new System::Windows::Forms::Button();
			this->Kamp8U = new System::Windows::Forms::Button();
			this->Kamp8H = new System::Windows::Forms::Button();
			this->Kamp7B = new System::Windows::Forms::Button();
			this->Kamp7U = new System::Windows::Forms::Button();
			this->Kamp7H = new System::Windows::Forms::Button();
			this->Kamp6B = new System::Windows::Forms::Button();
			this->Kamp6U = new System::Windows::Forms::Button();
			this->Kamp6H = new System::Windows::Forms::Button();
			this->Kamp5B = new System::Windows::Forms::Button();
			this->Kamp5U = new System::Windows::Forms::Button();
			this->Kamp5H = new System::Windows::Forms::Button();
			this->Kamp4B = new System::Windows::Forms::Button();
			this->Kamp4U = new System::Windows::Forms::Button();
			this->Kamp4H = new System::Windows::Forms::Button();
			this->Kamp3B = new System::Windows::Forms::Button();
			this->Kamp3U = new System::Windows::Forms::Button();
			this->Kamp3H = new System::Windows::Forms::Button();
			this->Kamp2B = new System::Windows::Forms::Button();
			this->Kamp2U = new System::Windows::Forms::Button();
			this->Kamp2H = new System::Windows::Forms::Button();
			this->textBox12 = new System::Windows::Forms::TextBox();
			this->textBox11 = new System::Windows::Forms::TextBox();
			this->textBox10 = new System::Windows::Forms::TextBox();
			this->textBox9 = new System::Windows::Forms::TextBox();
			this->textBox8 = new System::Windows::Forms::TextBox();
			this->textBox7 = new System::Windows::Forms::TextBox();
			this->textBox6 = new System::Windows::Forms::TextBox();
			this->textBox5 = new System::Windows::Forms::TextBox();
			this->textBox4 = new System::Windows::Forms::TextBox();
			this->textBox3 = new System::Windows::Forms::TextBox();
			this->textBox2 = new System::Windows::Forms::TextBox();
			this->Kamp1B = new System::Windows::Forms::Button();
			this->Kamp1U = new System::Windows::Forms::Button();
			this->Kamp1H = new System::Windows::Forms::Button();
			this->textBox1 = new System::Windows::Forms::TextBox();
			this->SuspendLayout();
			// 
			// button1
			// 
			this->button1->Location = System::Drawing::Point(24, 32);
			this->button1->Name = S"button1";
			this->button1->Size = System::Drawing::Size(104, 32);
			this->button1->TabIndex = 0;
			this->button1->Text = S"Åpne systemarkiv";
			this->button1->Click += new System::EventHandler(this, button1_Click);
			// 
			// button2
			// 
			this->button2->Location = System::Drawing::Point(24, 72);
			this->button2->Name = S"button2";
			this->button2->Size = System::Drawing::Size(104, 32);
			this->button2->TabIndex = 1;
			this->button2->Text = S"Sett opp stamme";
			this->button2->Click += new System::EventHandler(this, button2_Click);
			// 
			// button3
			// 
			this->button3->Location = System::Drawing::Point(24, 112);
			this->button3->Name = S"button3";
			this->button3->Size = System::Drawing::Size(104, 32);
			this->button3->TabIndex = 2;
			this->button3->Text = S"Generer system";
			this->button3->Click += new System::EventHandler(this, button3_Click);
			// 
			// Kamp12B
			// 
			this->Kamp12B->Location = System::Drawing::Point(200, 592);
			this->Kamp12B->Name = S"Kamp12B";
			this->Kamp12B->Size = System::Drawing::Size(24, 24);
			this->Kamp12B->TabIndex = 148;
			this->Kamp12B->Text = S" ";
			this->Kamp12B->Visible = false;
			// 
			// Kamp12U
			// 
			this->Kamp12U->Location = System::Drawing::Point(176, 592);
			this->Kamp12U->Name = S"Kamp12U";
			this->Kamp12U->Size = System::Drawing::Size(24, 24);
			this->Kamp12U->TabIndex = 147;
			this->Kamp12U->Text = S" ";
			this->Kamp12U->Visible = false;
			// 
			// Kamp12H
			// 
			this->Kamp12H->Location = System::Drawing::Point(152, 592);
			this->Kamp12H->Name = S"Kamp12H";
			this->Kamp12H->Size = System::Drawing::Size(24, 24);
			this->Kamp12H->TabIndex = 146;
			this->Kamp12H->Text = S" ";
			this->Kamp12H->Visible = false;
			// 
			// Kamp11B
			// 
			this->Kamp11B->Location = System::Drawing::Point(200, 560);
			this->Kamp11B->Name = S"Kamp11B";
			this->Kamp11B->Size = System::Drawing::Size(24, 24);
			this->Kamp11B->TabIndex = 145;
			this->Kamp11B->Text = S" ";
			this->Kamp11B->Visible = false;
			// 
			// Kamp11U
			// 
			this->Kamp11U->Location = System::Drawing::Point(176, 560);
			this->Kamp11U->Name = S"Kamp11U";
			this->Kamp11U->Size = System::Drawing::Size(24, 24);
			this->Kamp11U->TabIndex = 144;
			this->Kamp11U->Text = S" ";
			this->Kamp11U->Visible = false;
			// 
			// Kamp11H
			// 
			this->Kamp11H->Location = System::Drawing::Point(152, 560);
			this->Kamp11H->Name = S"Kamp11H";
			this->Kamp11H->Size = System::Drawing::Size(24, 24);
			this->Kamp11H->TabIndex = 143;
			this->Kamp11H->Text = S" ";
			this->Kamp11H->Visible = false;
			// 
			// Kamp10B
			// 
			this->Kamp10B->Location = System::Drawing::Point(200, 528);
			this->Kamp10B->Name = S"Kamp10B";
			this->Kamp10B->Size = System::Drawing::Size(24, 24);
			this->Kamp10B->TabIndex = 142;
			this->Kamp10B->Text = S" ";
			this->Kamp10B->Visible = false;
			// 
			// Kamp10U
			// 
			this->Kamp10U->Location = System::Drawing::Point(176, 528);
			this->Kamp10U->Name = S"Kamp10U";
			this->Kamp10U->Size = System::Drawing::Size(24, 24);
			this->Kamp10U->TabIndex = 141;
			this->Kamp10U->Text = S" ";
			this->Kamp10U->Visible = false;
			// 
			// Kamp10H
			// 
			this->Kamp10H->Location = System::Drawing::Point(152, 528);
			this->Kamp10H->Name = S"Kamp10H";
			this->Kamp10H->Size = System::Drawing::Size(24, 24);
			this->Kamp10H->TabIndex = 140;
			this->Kamp10H->Text = S" ";
			this->Kamp10H->Visible = false;
			// 
			// Kamp9B
			// 
			this->Kamp9B->Location = System::Drawing::Point(200, 480);
			this->Kamp9B->Name = S"Kamp9B";
			this->Kamp9B->Size = System::Drawing::Size(24, 24);
			this->Kamp9B->TabIndex = 139;
			this->Kamp9B->Text = S" ";
			this->Kamp9B->Visible = false;
			// 
			// Kamp9U
			// 
			this->Kamp9U->Location = System::Drawing::Point(176, 480);
			this->Kamp9U->Name = S"Kamp9U";
			this->Kamp9U->Size = System::Drawing::Size(24, 24);
			this->Kamp9U->TabIndex = 138;
			this->Kamp9U->Text = S" ";
			this->Kamp9U->Visible = false;
			// 
			// Kamp9H
			// 
			this->Kamp9H->Location = System::Drawing::Point(152, 480);
			this->Kamp9H->Name = S"Kamp9H";
			this->Kamp9H->Size = System::Drawing::Size(24, 24);
			this->Kamp9H->TabIndex = 137;
			this->Kamp9H->Text = S" ";
			this->Kamp9H->Visible = false;
			// 
			// Kamp8B
			// 
			this->Kamp8B->Location = System::Drawing::Point(200, 448);
			this->Kamp8B->Name = S"Kamp8B";
			this->Kamp8B->Size = System::Drawing::Size(24, 24);
			this->Kamp8B->TabIndex = 136;
			this->Kamp8B->Text = S" ";
			this->Kamp8B->Visible = false;
			// 
			// Kamp8U
			// 
			this->Kamp8U->Location = System::Drawing::Point(176, 448);
			this->Kamp8U->Name = S"Kamp8U";
			this->Kamp8U->Size = System::Drawing::Size(24, 24);
			this->Kamp8U->TabIndex = 135;
			this->Kamp8U->Text = S" ";
			this->Kamp8U->Visible = false;
			// 
			// Kamp8H
			// 
			this->Kamp8H->Location = System::Drawing::Point(152, 448);
			this->Kamp8H->Name = S"Kamp8H";
			this->Kamp8H->Size = System::Drawing::Size(24, 24);
			this->Kamp8H->TabIndex = 134;
			this->Kamp8H->Text = S" ";
			this->Kamp8H->Visible = false;
			// 
			// Kamp7B
			// 
			this->Kamp7B->Location = System::Drawing::Point(200, 416);
			this->Kamp7B->Name = S"Kamp7B";
			this->Kamp7B->Size = System::Drawing::Size(24, 24);
			this->Kamp7B->TabIndex = 133;
			this->Kamp7B->Text = S" ";
			this->Kamp7B->Visible = false;
			// 
			// Kamp7U
			// 
			this->Kamp7U->Location = System::Drawing::Point(176, 416);
			this->Kamp7U->Name = S"Kamp7U";
			this->Kamp7U->Size = System::Drawing::Size(24, 24);
			this->Kamp7U->TabIndex = 132;
			this->Kamp7U->Text = S" ";
			this->Kamp7U->Visible = false;
			// 
			// Kamp7H
			// 
			this->Kamp7H->Location = System::Drawing::Point(152, 416);
			this->Kamp7H->Name = S"Kamp7H";
			this->Kamp7H->Size = System::Drawing::Size(24, 24);
			this->Kamp7H->TabIndex = 131;
			this->Kamp7H->Text = S" ";
			this->Kamp7H->Visible = false;
			// 
			// Kamp6B
			// 
			this->Kamp6B->Location = System::Drawing::Point(200, 368);
			this->Kamp6B->Name = S"Kamp6B";
			this->Kamp6B->Size = System::Drawing::Size(24, 24);
			this->Kamp6B->TabIndex = 130;
			this->Kamp6B->Text = S" ";
			this->Kamp6B->Visible = false;
			// 
			// Kamp6U
			// 
			this->Kamp6U->Location = System::Drawing::Point(176, 368);
			this->Kamp6U->Name = S"Kamp6U";
			this->Kamp6U->Size = System::Drawing::Size(24, 24);
			this->Kamp6U->TabIndex = 129;
			this->Kamp6U->Text = S" ";
			this->Kamp6U->Visible = false;
			// 
			// Kamp6H
			// 
			this->Kamp6H->Location = System::Drawing::Point(152, 368);
			this->Kamp6H->Name = S"Kamp6H";
			this->Kamp6H->Size = System::Drawing::Size(24, 24);
			this->Kamp6H->TabIndex = 128;
			this->Kamp6H->Text = S" ";
			this->Kamp6H->Visible = false;
			// 
			// Kamp5B
			// 
			this->Kamp5B->Location = System::Drawing::Point(200, 336);
			this->Kamp5B->Name = S"Kamp5B";
			this->Kamp5B->Size = System::Drawing::Size(24, 24);
			this->Kamp5B->TabIndex = 127;
			this->Kamp5B->Text = S" ";
			this->Kamp5B->Visible = false;
			// 
			// Kamp5U
			// 
			this->Kamp5U->Location = System::Drawing::Point(176, 336);
			this->Kamp5U->Name = S"Kamp5U";
			this->Kamp5U->Size = System::Drawing::Size(24, 24);
			this->Kamp5U->TabIndex = 126;
			this->Kamp5U->Text = S" ";
			this->Kamp5U->Visible = false;
			// 
			// Kamp5H
			// 
			this->Kamp5H->Location = System::Drawing::Point(152, 336);
			this->Kamp5H->Name = S"Kamp5H";
			this->Kamp5H->Size = System::Drawing::Size(24, 24);
			this->Kamp5H->TabIndex = 125;
			this->Kamp5H->Text = S" ";
			this->Kamp5H->Visible = false;
			// 
			// Kamp4B
			// 
			this->Kamp4B->Location = System::Drawing::Point(200, 304);
			this->Kamp4B->Name = S"Kamp4B";
			this->Kamp4B->Size = System::Drawing::Size(24, 24);
			this->Kamp4B->TabIndex = 124;
			this->Kamp4B->Text = S" ";
			this->Kamp4B->Visible = false;
			// 
			// Kamp4U
			// 
			this->Kamp4U->Location = System::Drawing::Point(176, 304);
			this->Kamp4U->Name = S"Kamp4U";
			this->Kamp4U->Size = System::Drawing::Size(24, 24);
			this->Kamp4U->TabIndex = 123;
			this->Kamp4U->Text = S" ";
			this->Kamp4U->Visible = false;
			// 
			// Kamp4H
			// 
			this->Kamp4H->Location = System::Drawing::Point(152, 304);
			this->Kamp4H->Name = S"Kamp4H";
			this->Kamp4H->Size = System::Drawing::Size(24, 24);
			this->Kamp4H->TabIndex = 122;
			this->Kamp4H->Text = S" ";
			this->Kamp4H->Visible = false;
			// 
			// Kamp3B
			// 
			this->Kamp3B->Location = System::Drawing::Point(200, 256);
			this->Kamp3B->Name = S"Kamp3B";
			this->Kamp3B->Size = System::Drawing::Size(24, 24);
			this->Kamp3B->TabIndex = 121;
			this->Kamp3B->Text = S" ";
			this->Kamp3B->Visible = false;
			// 
			// Kamp3U
			// 
			this->Kamp3U->Location = System::Drawing::Point(176, 256);
			this->Kamp3U->Name = S"Kamp3U";
			this->Kamp3U->Size = System::Drawing::Size(24, 24);
			this->Kamp3U->TabIndex = 120;
			this->Kamp3U->Text = S" ";
			this->Kamp3U->Visible = false;
			// 
			// Kamp3H
			// 
			this->Kamp3H->Location = System::Drawing::Point(152, 256);
			this->Kamp3H->Name = S"Kamp3H";
			this->Kamp3H->Size = System::Drawing::Size(24, 24);
			this->Kamp3H->TabIndex = 119;
			this->Kamp3H->Text = S" ";
			this->Kamp3H->Visible = false;
			// 
			// Kamp2B
			// 
			this->Kamp2B->Location = System::Drawing::Point(200, 224);
			this->Kamp2B->Name = S"Kamp2B";
			this->Kamp2B->Size = System::Drawing::Size(24, 24);
			this->Kamp2B->TabIndex = 118;
			this->Kamp2B->Text = S" ";
			this->Kamp2B->Visible = false;
			// 
			// Kamp2U
			// 
			this->Kamp2U->Location = System::Drawing::Point(176, 224);
			this->Kamp2U->Name = S"Kamp2U";
			this->Kamp2U->Size = System::Drawing::Size(24, 24);
			this->Kamp2U->TabIndex = 117;
			this->Kamp2U->Text = S" ";
			this->Kamp2U->Visible = false;
			// 
			// Kamp2H
			// 
			this->Kamp2H->Location = System::Drawing::Point(152, 224);
			this->Kamp2H->Name = S"Kamp2H";
			this->Kamp2H->Size = System::Drawing::Size(24, 24);
			this->Kamp2H->TabIndex = 116;
			this->Kamp2H->Text = S" ";
			this->Kamp2H->Visible = false;
			// 
			// textBox12
			// 
			this->textBox12->Location = System::Drawing::Point(24, 592);
			this->textBox12->Name = S"textBox12";
			this->textBox12->Size = System::Drawing::Size(112, 20);
			this->textBox12->TabIndex = 160;
			this->textBox12->Text = S"textBox12";
			this->textBox12->Visible = false;
			// 
			// textBox11
			// 
			this->textBox11->Location = System::Drawing::Point(24, 560);
			this->textBox11->Name = S"textBox11";
			this->textBox11->Size = System::Drawing::Size(112, 20);
			this->textBox11->TabIndex = 159;
			this->textBox11->Text = S"textBox11";
			this->textBox11->Visible = false;
			// 
			// textBox10
			// 
			this->textBox10->Location = System::Drawing::Point(24, 528);
			this->textBox10->Name = S"textBox10";
			this->textBox10->Size = System::Drawing::Size(112, 20);
			this->textBox10->TabIndex = 158;
			this->textBox10->Text = S"textBox10";
			this->textBox10->Visible = false;
			// 
			// textBox9
			// 
			this->textBox9->Location = System::Drawing::Point(24, 480);
			this->textBox9->Name = S"textBox9";
			this->textBox9->Size = System::Drawing::Size(112, 20);
			this->textBox9->TabIndex = 157;
			this->textBox9->Text = S"textBox9";
			this->textBox9->Visible = false;
			// 
			// textBox8
			// 
			this->textBox8->Location = System::Drawing::Point(24, 448);
			this->textBox8->Name = S"textBox8";
			this->textBox8->Size = System::Drawing::Size(112, 20);
			this->textBox8->TabIndex = 156;
			this->textBox8->Text = S"textBox8";
			this->textBox8->Visible = false;
			// 
			// textBox7
			// 
			this->textBox7->Location = System::Drawing::Point(24, 416);
			this->textBox7->Name = S"textBox7";
			this->textBox7->Size = System::Drawing::Size(112, 20);
			this->textBox7->TabIndex = 155;
			this->textBox7->Text = S"textBox7";
			this->textBox7->Visible = false;
			// 
			// textBox6
			// 
			this->textBox6->Location = System::Drawing::Point(24, 368);
			this->textBox6->Name = S"textBox6";
			this->textBox6->Size = System::Drawing::Size(112, 20);
			this->textBox6->TabIndex = 154;
			this->textBox6->Text = S"textBox6";
			this->textBox6->Visible = false;
			// 
			// textBox5
			// 
			this->textBox5->Location = System::Drawing::Point(24, 336);
			this->textBox5->Name = S"textBox5";
			this->textBox5->Size = System::Drawing::Size(112, 20);
			this->textBox5->TabIndex = 153;
			this->textBox5->Text = S"textBox5";
			this->textBox5->Visible = false;
			// 
			// textBox4
			// 
			this->textBox4->Location = System::Drawing::Point(24, 304);
			this->textBox4->Name = S"textBox4";
			this->textBox4->Size = System::Drawing::Size(112, 20);
			this->textBox4->TabIndex = 152;
			this->textBox4->Text = S"textBox4";
			this->textBox4->Visible = false;
			// 
			// textBox3
			// 
			this->textBox3->Location = System::Drawing::Point(24, 256);
			this->textBox3->Name = S"textBox3";
			this->textBox3->Size = System::Drawing::Size(112, 20);
			this->textBox3->TabIndex = 151;
			this->textBox3->Text = S"textBox3";
			this->textBox3->Visible = false;
			// 
			// textBox2
			// 
			this->textBox2->Location = System::Drawing::Point(24, 224);
			this->textBox2->Name = S"textBox2";
			this->textBox2->Size = System::Drawing::Size(112, 20);
			this->textBox2->TabIndex = 150;
			this->textBox2->Text = S"textBox2";
			this->textBox2->Visible = false;
			// 
			// Kamp1B
			// 
			this->Kamp1B->Location = System::Drawing::Point(200, 192);
			this->Kamp1B->Name = S"Kamp1B";
			this->Kamp1B->Size = System::Drawing::Size(24, 24);
			this->Kamp1B->TabIndex = 115;
			this->Kamp1B->Text = S" ";
			this->Kamp1B->Visible = false;
			// 
			// Kamp1U
			// 
			this->Kamp1U->Location = System::Drawing::Point(176, 192);
			this->Kamp1U->Name = S"Kamp1U";
			this->Kamp1U->Size = System::Drawing::Size(24, 24);
			this->Kamp1U->TabIndex = 114;
			this->Kamp1U->Text = S" ";
			this->Kamp1U->Visible = false;
			// 
			// Kamp1H
			// 
			this->Kamp1H->Location = System::Drawing::Point(152, 192);
			this->Kamp1H->Name = S"Kamp1H";
			this->Kamp1H->Size = System::Drawing::Size(24, 24);
			this->Kamp1H->TabIndex = 113;
			this->Kamp1H->Text = S" ";
			this->Kamp1H->Visible = false;
			// 
			// textBox1
			// 
			this->textBox1->Location = System::Drawing::Point(24, 192);
			this->textBox1->Name = S"textBox1";
			this->textBox1->Size = System::Drawing::Size(112, 20);
			this->textBox1->TabIndex = 149;
			this->textBox1->Text = S"textBox1";
			this->textBox1->Visible = false;
			// 
			// Form1
			// 
			this->AutoScaleBaseSize = System::Drawing::Size(5, 13);
			this->ClientSize = System::Drawing::Size(552, 622);
			this->Controls->Add(this->Kamp12B);
			this->Controls->Add(this->Kamp12U);
			this->Controls->Add(this->Kamp12H);
			this->Controls->Add(this->Kamp11B);
			this->Controls->Add(this->Kamp11U);
			this->Controls->Add(this->Kamp11H);
			this->Controls->Add(this->Kamp10B);
			this->Controls->Add(this->Kamp10U);
			this->Controls->Add(this->Kamp10H);
			this->Controls->Add(this->Kamp9B);
			this->Controls->Add(this->Kamp9U);
			this->Controls->Add(this->Kamp9H);
			this->Controls->Add(this->Kamp8B);
			this->Controls->Add(this->Kamp8U);
			this->Controls->Add(this->Kamp8H);
			this->Controls->Add(this->Kamp7B);
			this->Controls->Add(this->Kamp7U);
			this->Controls->Add(this->Kamp7H);
			this->Controls->Add(this->Kamp6B);
			this->Controls->Add(this->Kamp6U);
			this->Controls->Add(this->Kamp6H);
			this->Controls->Add(this->Kamp5B);
			this->Controls->Add(this->Kamp5U);
			this->Controls->Add(this->Kamp5H);
			this->Controls->Add(this->Kamp4B);
			this->Controls->Add(this->Kamp4U);
			this->Controls->Add(this->Kamp4H);
			this->Controls->Add(this->Kamp3B);
			this->Controls->Add(this->Kamp3U);
			this->Controls->Add(this->Kamp3H);
			this->Controls->Add(this->Kamp2B);
			this->Controls->Add(this->Kamp2U);
			this->Controls->Add(this->Kamp2H);
			this->Controls->Add(this->textBox12);
			this->Controls->Add(this->textBox11);
			this->Controls->Add(this->textBox10);
			this->Controls->Add(this->textBox9);
			this->Controls->Add(this->textBox8);
			this->Controls->Add(this->textBox7);
			this->Controls->Add(this->textBox6);
			this->Controls->Add(this->textBox5);
			this->Controls->Add(this->textBox4);
			this->Controls->Add(this->textBox3);
			this->Controls->Add(this->textBox2);
			this->Controls->Add(this->Kamp1B);
			this->Controls->Add(this->Kamp1U);
			this->Controls->Add(this->Kamp1H);
			this->Controls->Add(this->textBox1);
			this->Controls->Add(this->button3);
			this->Controls->Add(this->button2);
			this->Controls->Add(this->button1);
			this->Name = S"Form1";
			this->Text = S"Systemtipp2011";
			this->ResumeLayout(false);

		}	
	private: System::Void button2_Click(System::Object *  sender, System::EventArgs *  e)
			 {

// =================================================
// == Setter opp stamme og eventuelle utgangstips ==
// =================================================

			Kamp1H->Visible=true;
			Kamp1U->Visible=true;
			Kamp1B->Visible=true;

			Kamp2H->Visible=true;
			Kamp2U->Visible=true;
			Kamp2B->Visible=true;

			Kamp3H->Visible=true;
			Kamp3U->Visible=true;
			Kamp3B->Visible=true;


			Kamp4H->Visible=true;
			Kamp4U->Visible=true;
			Kamp4B->Visible=true;

			Kamp5H->Visible=true;
			Kamp5U->Visible=true;
			Kamp5B->Visible=true;

			Kamp6H->Visible=true;
			Kamp6U->Visible=true;
			Kamp6B->Visible=true;

			Kamp7H->Visible=true;
			Kamp7U->Visible=true;
			Kamp7B->Visible=true;

			Kamp8H->Visible=true;
			Kamp8U->Visible=true;
			Kamp8B->Visible=true;

			Kamp9H->Visible=true;
			Kamp9U->Visible=true;
			Kamp9B->Visible=true;


			Kamp10H->Visible=true;
			Kamp10U->Visible=true;
			Kamp10B->Visible=true;

			Kamp11H->Visible=true;
			Kamp11U->Visible=true;
			Kamp11B->Visible=true;

			Kamp12H->Visible=true;
			Kamp12U->Visible=true;
			Kamp12B->Visible=true;

			textBox1->Visible=true;
			textBox2->Visible=true;
			textBox3->Visible=true;
			textBox4->Visible=true;
			textBox5->Visible=true;
			textBox6->Visible=true;
			textBox7->Visible=true;
			textBox8->Visible=true;
			textBox9->Visible=true;
			textBox10->Visible=true;
			textBox11->Visible=true;
			textBox12->Visible=true;
		
			 }

private: System::Void button1_Click(System::Object *  sender, System::EventArgs *  e);

#ifdef BUTTON1
private: System::Void button1_Click(System::Object *  sender, System::EventArgs *  e)
			 {
// 
// Open a directory, read the contents of it, and display the content files
// so the user can pick one of them.
//			 }
#endif

private: System::Void button3_Click(System::Object *  sender, System::EventArgs *  e)
			 {
//
//  Generate new system layout based on the Stamme and Utgangstips and store this in
//  the NTF file format (NTF = Norsk Tipping Filsystem). 
			 }

};



   
}

Open in new window

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question