1 Replies - 5108 Views - Last Post: 06 June 2012 - 01:48 AM

#1 busta5000  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: -7
  • View blog
  • Posts: 147
  • Joined: 08-March 08

basic button

Posted 27 May 2012 - 06:04 AM

I want a tutorial that helps me with c++ windows forms specifically regarding objects and buttons or textbox
I have the main project.cpp I wrote every class and object in it set and get functions.
I made a simple 3 text boxes with 1 button.
its like a cin and cout but in windows form this is a basic missing code
#include <iostream>
#include <cstring>
using namespace std;

class system
{
	private:
			int x;
			int y;
                        int z; //answer
	public:
			void setaddition(int a. int B)/>;
                        int getaddition();
			void print();
}
void setaddition(int a, int B)/>
{
a=x;
b=y;
}
int getaddition();
{
cin>>x;
cin>>y;
z=x+y;
}
void print()
{
cout<<z; //print in textbox3
}


What I want is that textbox1 = a; textbox2 = b; basicly a & b are cin and button & textbox3 are cout.
I want the result in textbox3.
remember I want the button to go to the getaddition to understand what it wants. I also want the textbox to be the cin for the values.

Is This A Good Question/Topic? 0
  • +

Replies To: basic button

#2 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3579
  • View blog
  • Posts: 11,130
  • Joined: 05-May 12

Re: basic button

Posted 06 June 2012 - 01:48 AM

You do it the same way you would do it in C#. Here is the C# code. I'll leave it to you to convert to C++ CLI:
a = Int32.Parse(textbox1.Text);
b = Int32.Parse(textbox2.Text);
int sum = a + b;
textbox3.Text = sum.ToString();


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1